10

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?

athosbr99
  • 463
  • 2
  • 7
  • 24

1 Answers1

14

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.

Jakuje
  • 24,773
  • 12
  • 69
  • 75
  • I'd think OP needs to both 1) have ssh-agent running (start it up) and 2) do ssh-add. That should do it. – eis Sep 07 '15 at 21:25