Reputation: 43
I have an issue connecting my github through VScode on my laptop. I have read other relevant questions like this and this with no luck (I created a new key from scratch). I have followed all steps for connecting to github with SSH succesfuly multiple times (generated new keys just in case). My problem is when I am trying to push. I followed instructions here. Everything works fine up until $ ssh-add -l -E sha256
The error message I get is The agent has no identities.
Could it be because I was connected to a different github account previously (I have two)?I created a new key so in theory they should be different.
Upvotes: 0
Views: 575
Reputation: 531055
The directions are somewhat misleading. They tell you to verify that your key is in the agent without telling you how to add it to the agent in the first place. (Actually, they do, but on a separate page.) You need to run a command like ssh-add ~/.ssh/my_key
first to populate the agent. (This needs to be repeated every time you start a new agent; techniques for automatically populating an agent with keys stored in a keychain are beyond the scope of this answer.)
I don't bother with an agent. Instead, I add something like the following to my SSH configuration file.
Host github.com
User git
IdentityFile ~/.ssh/my_key
Then, instead of needing to look in an active agent, ssh
simply looks for the file specified by IdentityFile
.
(If you add a passphrase to your key, the agent is convenient because you will only be prompted for the passphrase when you add the key to the agent, not every time ssh
tries to use the key.)
Upvotes: 2