'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
Solution 1:[1]
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
Solution 2:[2]
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:
- open the menu on top right with your avatar and click
settings - from your profile settings page click
Developer Settingsthat is the last option in the left menu - from the developer setting page click
Personal access token - click on the
generate new tokenbutton - select the duration and the access scope you want to give to this token and click on the
Generate tokenbutton
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | RobMcZag |
