Search code examples
gitgithubhttpsgit-clone

git clone with https error - fatal: repository not found


I forked a private repository that I was invited to collaborate on but every time I try to clone with HTTPS, I get the following error message:

$ git clone https://github.com/usernamex/privat-repo.git
cloning into 'privat-repo'...
Username for 'https://github.com':usernamex
Password for 'https://usernamex@github.com':
remote: Repository not found.
fatal: repository 'https://github.com/usernamex/privat-repo.git/' not found

Note: 'usernamex' and 'privat-repo' are just examples


Here's some things I have tried with no success:

  • Verified the validity of the URL - Checked spelling and case. I am able to access the repo URL and download its contents through my browser by clicking the download ZIP button.
  • Asked owner to clone my fork - He had no problems cloning my fork but I do.
  • Contacted GitHub support...
  • Per GitHub support, cleared cached credentials - this is confirmed by the fact that the system requires my username and password with git clone and git push. In fact, I can clone and push other (public) repositories in my account.
  • Went through GitHub's HTTPS Cloning Errors guide with the exception of "Using SSH instead" because this doesn't really address the issue.
  • Viewed similar questions in stackoverflow.com - tried most suggested answers (see above).

I am running git 2.10 on a mac through Terminal and, as I mentioned, I am not interested in workarounds to HTTPS (e.g.: SSH or GitHub Desktop).

Any ideas why this is happening?


Solution

  • 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