I'm using Git on Windows, and a week ago I set up my SSH keys. I cloned my repos and it worked fine.
Then, today I tried to make a pull and this happens:
$ git pull
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I tried to run a ssh-add-l
and returned this:
$ ssh-add -l
The agent has no identities.
However my key files are on the same place. I faced this problem a while ago on a Mac, but then I just did another key and it worked. What can I do without generating another SSH key?
As a security precaution, GitHub automatically deletes SSH keys that haven't been used in a year.
SSH key management has a variety of pitfalls such as stale credentials, orphaned keys, and can easily conceal malicious keys inserted by malware or intruders to maintain persistence. At Sandfly we have seen incidents where SSH credentials were stolen or used to insert backdoor access for intruders and malware.
By default, the agent uses SSH keys stored in the . ssh directory under the user's home directory. The ssh-add command is used for adding identities to the agent.
Enter ls -al ~/.ssh to see if existing SSH keys are present. Check the directory listing to see if you already have a public SSH key.
ssh-agent
is not persistent across reboots. You need to start agent (equivalent to Linux eval $(ssh-agent)
) and then you need to add them manually after reboot or setup some script to load them automatically.
If you have have your keys in "default location", like ~/.ssh/id_rsa
, it should be enough to run ssh-add
, otherwise you need to run ssh-add path/to/your/private/key
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With