Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 360
shaleshock Avatar asked Feb 24 '17 18:02

shaleshock


People also ask

How do I fix the fatal not a git repository error?

To do so, you need to navigate to the correct folder and then run the command git init , which will create a new empty Git repository or reinitialize an existing one.

How do you fix fatal origin does not appear to be a git repository?

Note: The “fatal: 'origin' does not appear to be a git repository” error occurs when you try to push code to a remote Git repository without telling Git the exact location of the remote repository. To solve this error, use the git remote add command to add a remote to your project.

What does fatal not a git repository mean?

What does “fatal: not a git repository” mean? This error means you attempted to run a Git command, but weren't inside a Git repository. Make sure you've: Navigated to the right directory.


2 Answers

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

like image 138
Pejman Avatar answered Sep 25 '22 03:09

Pejman


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
like image 22
Pete Schmitz Avatar answered Sep 22 '22 03:09

Pete Schmitz