gpg-agent asks for ssh password, although the private key has no password set
Problem
I am using gpg-agent to manage my github ssh key. I generate my (private) ssh key via openpgpg2ssh from my private gpg key. Unfortunately, although my private gpg key is not password protected, gpg-agent asks me for a password (via a nice X dialog) before I ssh/git to github. Entering nothing works…
Error Output
~$ eval "$(gpg-agent --enable-ssh-support --daemon)" ~$ gpg2 --export-secret-keys | openpgp2ssh | ssh-add /dev/stdin Identity added: /dev/stdin (/dev…
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Configure gpg-agent to Avoid SSH Password Prompt
The gpg-agent is configured to prompt for a passphrase when using the SSH key, even though the key itself does not have a passphrase. This can occur if the gpg-agent is not correctly set up to handle the SSH key or if the key is not properly recognized as a valid SSH key.
Awaiting Verification
Be the first to verify this fix
- 1
Check gpg-agent Configuration
Ensure that gpg-agent is configured to support SSH. You need to verify that the configuration file includes the necessary options.
bashecho 'enable-ssh-support' >> ~/.gnupg/gpg-agent.conf - 2
Restart gpg-agent
After modifying the gpg-agent configuration, restart the agent to apply the changes. This ensures that the new settings take effect.
bashgpgconf --kill gpg-agent && gpg-agent --daemon --enable-ssh-support - 3
Re-add SSH Key to gpg-agent
Re-add your SSH key to the gpg-agent to ensure it is recognized correctly. This step helps in clearing any cached passphrase prompts.
bashgpg2 --export-secret-keys | openpgp2ssh | ssh-add /dev/stdin - 4
Test SSH Connection
Attempt to connect to GitHub using SSH to verify that the password prompt no longer appears. If configured correctly, the connection should succeed without a password prompt.
bashssh -T git@github.com
Validation
To confirm the fix worked, run the SSH test command. If you receive a welcome message from GitHub without being prompted for a password, the issue is resolved.
Sign in to verify this fix