Skip to content

SSH Agent

ssh-agent is a helper to manage ssh keys and their passphrases, it is commonly used when you have created password-protected ssh keys (and for me in combination with git), in order to not have to type it in every time you commit or pull.

source

(provided you already have created a key)

  1. enable the service
    Terminal window
    Get-Service ssh-agent | Set-Service -StartupType Automatic -PassThru | Start-Service
  2. manually start the service the first time (or reboot)
    Terminal window
    start-ssh-agent.cmd
  3. add private key to ssh agent
    Terminal window
    ssh-add ~/.ssh/id_ed25519
  4. make sure that git uses the system ssh instead of the bundled one
    Terminal window
    git config --global core.sshCommand C:/Windows/System32/OpenSSH/ssh.exe
  5. (optional): test the ssh connection (this will also prompt for host key verification)

source

  • start the ssh-agent
    Terminal window
    eval $(ssh-agent)
  • add the keys
    Terminal window
    ssh-add ~/.ssh/id_ed25519
  • from now on, you can use your key without having to type in the password each time

you don’t need to set it up manually, just enter it and remember you can remember it when entering it (e.g. when using vscode to pull changes)

https://superuser.com/a/1158050

~/.ssh/config and enable the UseKeychain option:

Host *
UseKeychain yes

then, you can enter it once more and it will be remembered

this is already in chezmoi