gitauthenticationgithubgit-cloneprivate-repository

Clone A Private Repository (Github)


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/username/reponame.git


Solution

  • Private clone URLs take the form git@github.com:username/repo.git - perhaps you needed to use git@ rather than git://?

    git:// URLs are read only, and it looks like private repos do not allow this form of access.