Cloning a private Github repo
Private clone URLs take the form [email protected]: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.
This worked for me:
git clone https://[email protected]/username/repo_name
I have met this issue several times and every time I landed on this page, tried every thing and failed!
It's because I have 2FA enabled!!!
According to https://help.github.com/articles/which-remote-url-should-i-use/#when-2fa-is-enabled
If you have enabled two-factor authentication, or if you are accessing an organization that uses SAML single sign-on, you must provide a personal access token instead of entering your password for HTTPS Git.
- Follow this link and create an access token
git clone https://github.com/username/repo_name.git
(The default git repo link is good enough!)- Enter your username and use the access token as password!!
Update:
- If you don't mind exposing your access token in the command line, you can also paste the access token as username then hit enter enter (no need for password).
- Hate copy&pasting the access token over and over again?
Usegit config credential.helper store
(don't do this on machine you don't trust)