athosbr99
athosbr99

Reputation: 483

ssh-agent suddenly "lost" my key

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?

Upvotes: 12

Views: 8990

Answers (1)

Jakuje
Jakuje

Reputation: 25926

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.

Upvotes: 15

Related Questions