Nils Schlüter
Nils Schlüter

Reputation: 1436

Can't clone private Github repositories over HTTPS

I have problems cloning private GitHub Repositories over HTTPS. If i try to clone my repository using:

git clone https://github.com/{username}/{repository}

i get the error:

fatal: remote error: Repository not found

when i try to enter my credentials in the request like this:

git clone https://{username}@github.com/{username}/{repository}

I get the error:

fatal: Unable to look up {username}@github.com (port 9418)

Cloning over ssh works without. Cloning public repositories also works over https. Does anybody know what i could do? I'm using windows 10 and git for windows version 2.14.13

Upvotes: 3

Views: 4877

Answers (2)

RobMcZag
RobMcZag

Reputation: 645

Recent changes in GitHub security do not allow anymore to use your Password to authenticate when cloning a repo.

To overcome this issue you have to generate a Personal access token and use it in place of your password.

To generate a token:

  1. open the menu on top right with your avatar and click settings
  2. from your profile settings page click Developer Settings that is the last option in the left menu
  3. from the developer setting page click Personal access token
  4. click on the generate new token button
  5. select the duration and the access scope you want to give to this token and click on the Generate token button

You will be able to see the token only at this time, so use / save it before closing the page.

Now that you have the PAT you can use it in place of the password when cloning or logging in with git clients. BTW it is better to have a different token for each client.

Upvotes: 0

Ortomala Lokni
Ortomala Lokni

Reputation: 62515

You can clone your repository with:

git clone https://[email protected]/username/repo_name

It can also help to check your git configuration with:

git config -l

Upvotes: 5

Related Questions