Git: Permission denied (publickey) fatal - Could not read from remote repository. while cloning Git repository
For people that come here that are just trying to get the repository but don't care about the protocol (ssh / https), you might just want to use https instead of ssh (if it's supported).
So for example you use
git clone https://github.com/%REPOSITORYFOLDER%/%REPOSITORYNAME%.git
instead of
git clone [email protected]:%REPOSITORYFOLDER%/%REPOSITORYNAME%.git
Note that GitHub deprecated password authentication (https login) for private repositories due to it not keeping up with the latest security standards.
Note also that beginning March 1, 2022, Bitbucket users will no longer be able to use their Atlassian account password with git over https, but instead need to use Bitbucket app passwords.
If there is still issue around access after creating SSH and adding it in your Bitbucket account or wherever, you need to do the following in terminal on GitBash, OSX or Linux:
# Lists already added identities (‘ssh keys’)
ssh-add -l
Then, if you don't see your key listed, add it with the following (replace identity
with its real name):
# Add a new identity
ssh-add ~/.ssh/identity
This worked for me.
It looks like a permissions issue - not a Windows 7 issue.
Your ssh key is not authorised - Permission denied (publickey)
.
You need to create a public ssh key and ask the administrator of the Git repository to add the ssh
public key
Information on how to do this: Saving ssh key fails
I faced the same problem with GitHub. Here's how to solve it!
- Generate a SSH key on your computer as described here : Generating SSH keys.
- Login your GitHub account: GitHub Login.
- In your account, add the newly generated SSH Key: My account SSH keys.
- Try again to
git clone
the project.