8

I am trying to use ssh-agent to allow passphrase-less use of an ED25519 SSH key with a passphrase to sign a Git commit.

However, whenever I do a commit from command line I am asked for the passphrase every time. I believe this is a configuration issue as Visual Studio is working as expected, just not the command line or Visual Studio Code.

I am using the standard Windows environment, not Git Bash or WSL.

  • ssh-agent is setup to run on boot and verified
  • ssh-add -l shows the correct key has been added
  • I have set GIT_SSH to C:\Windows\System32\OpenSSH\ssh.exe

Git configuration-wise

  • core.sshCommand = C:/Windows/System32/OpenSSH/ssh.exe
  • signingkey is set to the key added to ssh-agent
  • commit.gpgsign = true
  • gpg.format = ssh

Screenshot of a terminal window showing the SSH configuration

OS Windows 10 22H2
Git 2.49.0.windows.1
Terminal 1.22.10731.0
PowerShell 7.5.0

1 Answer 1

7

Signing using SSH keys does not involve ssh.exe – it uses ssh-keygen.exe.

Running Git for Windows in any way will include the "Git Bash" environment in $PATH (as, among other things, it provides tools that a few Git subcommands still require), so the ssh-keygen that's being run is the MingW OpenSSH build that doesn't know how to talk to your Win32 OpenSSH ssh-agent (the concept of "Unix sockets" was ported in two slightly incompatible ways).

You need to additionally set gpg.ssh.program to point to the correct ssh-keygen executable.

1
  • 1
    I used this to set gpg.ssh.program and it's now working. git config --global gpg.ssh.program (Get-Command ssh-keygen.exe).Source git config --global core.sshCommand (Get-Command ssh.exe).Source Commented Apr 17 at 9:09

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.