3

Before somebody says this is duplicate (ok it may be but...) I checked this, this, this, this, this and many other links but it seems no one provided the answer I'm looking for.

My machine is an Arch Linux, and I'm using standard updated openssh suite and git 2.29.2. I have my SSH key (~/.ssh/id_ed25519) created and protected by a password, the public part is in GitHub. Locally my remote is configured to use ssh:

$ git remote -v
origin  git@github.com:my-account/git.git (fetch)
origin  git@github.com:my-account/git.git (push)

git pull and git push works fine, as long as I enter the ssh key password. I decided to follow Arch Wiki's ssh-agent article. I started the agent:

$ eval $(ssh-agent)
Agent pid 33150

I added the key:

$ ssh-add ~/.ssh/id_ed25519
Enter passphrase for /home/user/.ssh/id_ed25519: 
Identity added: /home/user/.ssh/id_ed25519 (user@machine)

I confirmed the key was added:

$ ssh-add -l
256 SHA256:MlO552tuyNhfE2x1CeVdzT4QpeaavT229V2UcHDgIX8 user@machine (ED25519)

I also added AddKeysToAgent yes to ~/.ssh/config as indicated in the Arch Wiki (I also tried to put Host * in a line above, to no avail):

$ cat ~/.ssh/config
AddKeysToAgent yes

But every time I try to push or pull I get prompted to enter the password. Once I enter it, it works:

$ git push
Enter passphrase for key '/home/user/.ssh/id_ed25519': 
Everything up-to-date
$ git push
Enter passphrase for key '/home/user/.ssh/id_ed25519': 
Everything up-to-date

Any idea of what may be going on?

EDIT:

I just tested something: I copied my pub key to another server, and I can connect to that server just fine, without being prompted for the key passphrase. That hints me that the issue is with git/github, not ssh. Any ideas?

Adriano_Pinaffo
  • 1,429
  • 4
  • 23
  • 46

1 Answers1

1

The wiki does mention adding the configuration setting AddKeysToAgent yes to ~/.ssh/config.

If this work on another server (with cached passphrase in the ssh-agent), compare the environment variable between the two (in particular, any variable with SSH in its name)

As the OP Adriano Pinaffo mentions in the comments, restarting the computer was enough to make it work.
It is possible a process was keeping an handle on an SSH resource, which prevented the agent to work properly.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250