Blikoor
Posted on November 18, 2021
• Windows 10 v20H2 • Git v2.33.0.windows.2 • Portable OpenSSH
I'm at my wit's end trying to figure out how to manage SSH keys stored by the ssh-agent. I expect to be able to list the keys and delete all or individual keys as needed. The Microsoft Docs doesn't give any indication of how to do this, but at least point you to the OpenSSH Manual.
However, the commands do not work!
I have searched for solutions on the internet, but I couldn't find any. I'll explain the issue in more detail with the following steps:
I Verified that the path for the ssh-agent used by Git is properly configured and associated with Portable OpenSSH in Windows.
PS Get-Command ssh | Select-Object Source
> Source
> ------
> C:\Windows\System32\OpenSSH\ssh.exe
1. Test the SSH connection to confirm that SSH authentication is working.
PS ssh -T git@github.com
> Enter passphrase for key 'C:\Users\Blikoor/.ssh/id_ed25519':
> Hi blikoor! You've successfully authenticated, but GitHub does not provide shell access.
2. To lists the public keys of all identities currently managed by the ssh-agent. I expected a list containing the Ed25519 key(s) stored by the agent.
PS ssh-add -L
> The agent has no identities.
3. To delete a specific or list of identities from the ssh-agent. I expected the agent to remove the private key corresponding to the specified public key.
PS ssh-add -d $env:USERPROFILE\.ssh\id_ed25519.pub
> Could not remove identity "C:\Users\Blikoor\.ssh\id_ed25519.pub": agent refused operation
4. To delete all identities from the ssh-agent. I expected the agent to remove all the private keys, but even though it seems successful, the SSH authentication test in the next step disproof this assumption.
PS ssh-add -D
> All identities removed.
5. Test the SSH connection again after deleting all keys. I expected that the test will fail, yet the second test is successful as well.
PS ssh -T git@github.com
> Enter passphrase for key 'C:\Users\Blikoor/.ssh/id_ed25519':
> Hi blikoor! You've successfully authenticated, but GitHub does not provide shell access.
Posted on November 18, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.