Skip to main content

이 버전의 GitHub Enterprise Server는 2023-09-12. 중요한 보안 문제에 대해서도 패치 릴리스가 이루어지지 않습니다. 성능 향상, 향상된 보안, 새로운 기능을 위해 최신 버전의 GitHub Enterprise로 업그레이드합니다. 업그레이드에 대한 도움말은 GitHub Enterprise 지원에 문의하세요.

명령줄을 사용하여 외부 Git 리포지토리 가져오기

소스 코드가 Git 리포지토리에서 추적되는 경우 명령줄에서 Git을 사용하여 리포지토리를 가져올 수 있습니다.

Before you start, make sure you know:

  • Your GitHub Enterprise Server username
  • The clone URL for the external repository, such as https://external-host.com/user/repo.git or git://external-host.com/user/repo.git (perhaps with a user@ in front of the external-host.com domain name)

For purposes of demonstration, we'll use:

  • An external account named extuser
  • An external Git host named https://external-host.com
  • A GitHub Enterprise Server personal account named ghuser
  • A repository on your GitHub Enterprise Server instance named repo.git
  1. Create a new repository on GitHub Enterprise Server. You'll import your external Git repository to this new repository.

  2. On the command line, make a "bare" clone of the external repository using the external clone URL. This creates a full copy of the data, but without a working directory for editing files, and ensures a clean, fresh export of all the old data.

    $ git clone --bare https://external-host.com/EXTUSER/REPO.git
    # Makes a bare clone of the external repository in a local directory
    
  3. Push the locally cloned repository to GitHub Enterprise Server using the "mirror" option, which ensures that all references, such as branches and tags, are copied to the imported repository.

    $ cd REPO.git
    $ git push --mirror https://HOSTNAME/USER/REPO.git
    # Pushes the mirror to the new repository on your GitHub Enterprise Server instance
    
  4. Remove the temporary local repository.

    cd ..
    rm -rf REPO.git
    

If the repository you are importing contains large files, you may run into a warning or error. For more information on large files and how to manage them, see "About large files on GitHub."