git clone with https error - fatal: repository not found

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 [email protected]: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 = [email protected]:USERNAME/REPO.git

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:[email protected]/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