SSHexit code > 0

sign_and_send_pubkey: signing failed

$sign_and_send_pubkey: signing failed: agent refused operation Permission denied (publickey).

Analysis

The SSH agent is running but refused to sign the authentication request, often due to file permission issues or a corrupted agent state.

Common Triggers

  • SSH keys loaded into the agent have incorrect permissions.
  • The GNOME Keyring or macOS Keychain is interfering with ssh-agent.

Debug Checks

  • $Check environment variables: echo $SSH_AUTH_SOCK.

Resolution

1
Remove all keys and re-add them: ssh-add -D && ssh-add.
2
Kill and restart the agent: eval "$(ssh-agent -s)".