Git – Clone A Private Repository (Github)

gitgit-clonegithubprivaterepository

I have a private repository on Github for a project I'm working on. Until now I had only worked on my home desktop, but I just bought a laptop, and am trying to set it up so that I can work on the project from either computer, and push / pull changes.

I added a new SSH key to my Github account for the laptop, and was successful in cloning and making changes to a public test repo that I set up. However, I couldn't clone the private repo. Is there anything special I need to do in the command line in order to clone a private repo? Do I need to set up a new GitHub account for my laptop and set myself up as a collaborator?

The command I used was git clone git://github.com/myusername/reponame.git

Best Answer

This worked for me:

git clone https://username@github.com/username/repo_name