Set up
C:\Users\<username>\.ssh\config
Host github-account1
HostName github.com
User git
IdentityFile ~/.ssh/<folder1>/id_ed25519
Host github-account2
HostName github.com
User git
IdentityFile ~/.ssh/<folder2>/id_ed25519
I had a problem where
✅ ❌
ssh -T git@github-account1 workinggit ls-remote account1 failingThe reason was that the commands were using different SSH executables:
Manual SSH:
C:\Windows\System32\OpenSSH\ssh.exe
Git:
C:\Program Files\Git\mingw64\bin\ssh.exe
Your Windows OpenSSH was correctly reading:
Fixed with:C:\Users\AndrewPotts\.ssh\config
and using the
github-account2 host alias, while Git's bundled SSH was not behaving the same way.git config --global core.sshCommand "C:/Windows/System32/OpenSSH/ssh.exe"
If you use ssh-agent (OpenSSH Authentication Agent)
If you use ssh-agent (OpenSSH Authentication Agent)
and add the private keys, it should persist across reboots
ssh-add C:\Users\<username>\.ssh\<account1>\id_ed25519
ssh-add C:\Users\<username>\.ssh\<account2>\id_ed25519