git clone with https error - fatal: repository not found git clone with https error - fatal: repository not found git git

git clone with https error - fatal: repository not found


This Github document reads:

The https:// clone URLs are available on all repositories, public and private.

But since you are trying to access a private repository, authentication is required. One way is appending username and password the address as below:

git clone https://username:password@github.com/usernamex/privat-repo.git

But the same page reads:

If you have enabled two-factor authentication, or if you are accessing an organization that uses SAML single sign-on (SSO), you must authenticate with a personal access token instead of your username and password for GitHub.

If you have 2FA enabled, check this page for steps to generate a personal access token. Bear in mind that you should check full repo scope (as shown below) for your personal token.

enter image description here


I was also experiencing some issues with github credentials today, since it appears the user/pass authentication has been deprecated:

Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.

I ended up adding a new SSH key for github authentication. And, important notes:


Don't use HTTPS to clone:

git clone https://github.com/USERNAME/REPO.git

Instead use SSH to clone:

git clone git@github.com:USERNAME/REPO.git

Don't use HTTPS as your upstream in .git/config

[remote "origin"]    url = https://github.com/USERNAME/REPO.git

Instead use SSH as your upstream in .git/config

[remote "origin"]    url = git@github.com:USERNAME/REPO.git


With https, you need to create a personal access token (PAT) and use this token as your password every time. Do not use your Github password for 2FA.

But, since doing this is illogical, the easiest way is to use ssh and not https

Generate your ssh token and add it to your account per Github documentationhttps://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agentThen, clone the repo locally,

git clone git@github.com:USERNAME/REPO.git

Please make sure to also update your .git/config file to match this ssh url

[remote "origin"]        url = git@github.com:USERNAME/REPO.git        fetch = +refs/heads/*:refs/remotes/origin/*