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.

- 43
- 1
- 5
-
Please [edit] to explain within the question itself what you have done so far, as text we can copy/paste at the prompt or into a search engine. – tripleee Jun 22 '22 at 13:58
-
Like the guideline says immediately after this instruction, "If it does not print anything, you will need to generate a new SSH key and associate it with GitHub." – tripleee Jun 22 '22 at 14:01
-
I have generated multiple keys and I still get the same issue. It is not that I don't get anything to print but that I get The agent has no identities. – Danai Jun 22 '22 at 14:10
-
1Sounds like you didn't add them with `ssh-add` (without `-l`) then. – tripleee Jun 22 '22 at 14:12
-
1That `ssh-add` command *verifies* that your key is in the agent; it does not actually *add* the key to the agent. The directions are somewhat misleading. – chepner Jun 22 '22 at 14:13
-
Great thanks, I added the new identity but I still can't push. Any ideas? – Danai Jun 22 '22 at 14:17
1 Answers
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.)

- 497,756
- 71
- 530
- 681
-
I managed to add the new identity but I still can't push. I get the same error ERROR: Permission to repo.github.io.git denied to username. fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. Sorry I am new at this. – Danai Jun 23 '22 at 11:15