About cloning a repository
You can clone a repository from your GitHub Enterprise Server instance to your local computer to make it easier to fix merge conflicts, add or remove files, and push larger commits. When you clone a repository, you copy the repository from your GitHub Enterprise Server instance to your local machine.
Cloning a repository pulls down a full copy of all the repository data that your GitHub Enterprise Server instance has at that point in time, including all versions of every file and folder for the project. You can push your changes to the remote repository on your GitHub Enterprise Server instance, or pull other people's changes from your GitHub Enterprise Server instance. For more information, see "Using Git".
You can clone your existing repository or clone another person's existing repository to contribute to a project.
Cloning a repository
-
On your GitHub Enterprise Server instance, navigate to the main page of the repository.
-
ファイルのリストの上にある [コード] をクリックしてく� さい。
-
リポジトリの URL をコピーします。
- HTTPS を使ってリポジトリをクローンするには、[HTTPS] の下の をクリックします。
- 組織の SSH 認証局から発行された証明書を含む SSH キーを使用してリポジトリをクローンするには、 [SSH] 、 の� �にクリックします。
- GitHub CLI を使ってリポジトリをクローンするには、 [GitHub CLI] 、 の� �にクリックします。
-
を開きます。
-
カレントワーキングディレクトリを、ディレクトリをクローンしたい� �所に変更します。
-
「
git clone
」と入力し、既にコピーした URL を貼り付けます。$ git clone https://ホスト名/YOUR-USERNAME/YOUR-REPOSITORY
-
Enter キー を押してローカル クローンを作成します。
$ git clone https://ホスト名/YOUR-USERNAME/YOUR-REPOSITORY > Cloning into `Spoon-Knife`... > remote: Counting objects: 10, done. > remote: Compressing objects: 100% (8/8), done. > remove: Total 10 (delta 1), reused 10 (delta 1) > Unpacking objects: 100% (10/10), done.
Cloning an empty repository
An empty repository contains no files. It's often made if you don't initialize the repository with a README when creating it.
-
On your GitHub Enterprise Server instance, navigate to the main page of the repository.
-
To clone your repository using the command line using HTTPS, under "Quick setup", click . To clone the repository using an SSH key, including a certificate issued by your organization's SSH certificate authority, click SSH, then click .
Alternatively, to clone your repository in Desktop, click Set up in Desktop and follow the prompts to complete the clone.
-
を開きます。
-
カレントワーキングディレクトリを、ディレクトリをクローンしたい� �所に変更します。
-
「
git clone
」と入力し、既にコピーした URL を貼り付けます。$ git clone https://ホスト名/YOUR-USERNAME/YOUR-REPOSITORY
-
Enter キー を押してローカル クローンを作成します。
$ git clone https://ホスト名/YOUR-USERNAME/YOUR-REPOSITORY > Cloning into `Spoon-Knife`... > remote: Counting objects: 10, done. > remote: Compressing objects: 100% (8/8), done. > remove: Total 10 (delta 1), reused 10 (delta 1) > Unpacking objects: 100% (10/10), done.
Troubleshooting cloning errors
When cloning a repository it's possible that you might encounter some errors.
If you're unable to clone a repository, check that:
- You can connect using HTTPS. For more information, see "HTTPS cloning errors."
- You have permission to access the repository you want to clone. For more information, see "Error: Repository not found."
- The default branch you want to clone still exists. For more information, see "Error: Remote HEAD refers to nonexistent ref, unable to checkout."