git - Clone A Private Repository (Github)

ID : 10321

viewed : 45

Tags : gitauthenticationgithubgit-cloneprivate-repositorygit

Top 5 Answer for git - Clone A Private Repository (Github)

vote vote


This worked for me:

git clone

vote vote


Private clone URLs take the form - 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.

vote vote


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

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.

  1. Follow this link and create an access token
  2. git clone (The default git repo link is good enough!)
  3. Enter your username and use the access token as password!!


  • 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?
    Use git config credential.helper store (don't do this on machine you don't trust)
vote vote


This worked for me:

git clone 
vote vote


For me the solution was:

git clone https://myusername@restoftherepolink.git 

Here you need to be the owner of the repo but if you aren't then it will go as

git clone 

If you have 2FA enabled then:

  1. Go to the settings from the profile icon in top right or visit
  2. Go to the bottom tab or go to
  3. Open last tab here Personal tokens. And generate a token
  4. Copy the token and run git clone https://myusername@restoftherepolink.git

When prompted for password put that token in here. Token generation image here

Top 3 video Explaining git - Clone A Private Repository (Github)