When you create a repository on GitHub, it exists as a remote repository. You can clone your repository to create a local copy on your computer and sync between the two locations.
About cloning a repository
You can clone a repository from GitHub 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 GitHub to your local machine.
Cloning a repository pulls down a full copy of all the repository data that GitHub 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 GitHub, or pull other people’s changes from GitHub. For more information, see “Using common Git commands“.
You can clone your existing repository or clone another person’s existing repository to contribute to a project.
Tip: You can also clone a repository using the GitHub CLI. For more information, see “gh repo clone
” in the GitHub CLI documentation.
Cloning a repository using the command line
- On GitHub, navigate to the main page of the repository.
- Above the list of files, click Code.
- To clone the repository using HTTPS, under “Clone with HTTPS”, click . To clone the repository using an SSH key, including a certificate issued by your organization’s SSH certificate authority, click Use SSH, then click . To clone a repository using GitHub CLI, click Use GitHub CLI, then click .
- Open TerminalTerminalGit Bash.
- Change the current working directory to the location where you want the cloned directory.
- Type
git clone
, and then paste the URL you copied earlier.$ git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY
- Press Enter to create your local clone.
$ git clone https://github.com/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 a repository to GitHub Desktop
- On GitHub, navigate to the main page of the repository.
- Above the list of files, click Code.
- Click Open with GitHub Desktop to clone and open the repository with GitHub Desktop.
- Follow the prompts in GitHub Desktop to complete the clone.
For more information, see “Cloning a repository from GitHub to GitHub Desktop.”
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 GitHub, 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.
- Open TerminalTerminalGit Bash.
- Change the current working directory to the location where you want the cloned directory.
- Type
git clone
, and then paste the URL you copied earlier.$ git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY
- Press Enter to create your local clone.
$ git clone https://github.com/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:
Awesome article post. Really looking forward to read more. Want more. Cecily Nate Hui
Its not my first time to go to see this site, i am visiting this site dailly and take nice data from here daily. Aloisia Hunt Gretchen
PC. We think that something then PC is the way to go. Grayce Roderick Roti
Thumbs up! I truly appreciate this post. Your article has proven useful to me. I enjoyed reading this. Melitta Udale Madalyn
I really like reading through an article that will make people think. Also, thanks for permitting me to comment. Benoite Maury Loraine
He nods confidently as he drapes the black garment over his neck. Eveline Jerad Cleasta
Small, black and white Apex, with or without flasher, works very well for migrating Coho. Lusa Tripp Basset
Unquestionably believe that which you stated. Your favorite reason appeared to be on the net the easiest thing to be aware of. Mirella Teodorico Nolita
Way cool! Some very valid points! I appreciate you penning this write-up plus the rest of the site is also very good. Jacklin Oberon Obla
Really enjoyed this article. Really thank you! Want more. Isabelita Ike Hogle
Deference to post author, some fantastic selective information. Kerrill Bondie Bearce
Hello There. I discovered your blog using msn. That is a very well written article. Leela Ware Keon
I googled your name and the first three entries that came up were about Eleana Johnson. Annabal Justin Smalley
I visited various blogs except the audio feature for audio songs present at this web page is genuinely excellent. Eveleen Harvey Edd
You have noted very interesting points! ps nice site. Janel Peter Raimes
master essay writing psychological research proposal writing an analytical essay
Hi there! I just wish to offer you a huge thumbs up for the excellent info you have here on this post. I will be returning to your site for more soon. Liv Frank Rocco
homework help online internship cover letters buy essay.org
Merely wanna comment on few general things, The website style is perfect, the content material is very good : D. Auroora Pippo Prissie
I visited various web pages except the audio quality for audio songs current at this site is genuinely excellent. Gillie Chevy Shanley
I feel that is among the so much vital information for me. Rosabel Isacco Lucic
I always used to study paragraph in news papers but now as I am a user of web therefore from now I am using net for content, thanks to web. Aridatha Tedmund Mab
I must say I read a great article with pleasure
It is a very good useful article I like to read such articles
It is a very good useful article I like to read such articles
I get very useful information on your page, I feel lucky