Git keeps asking me for "Enter passphrase for key"

Hi,

I am trying to setup git so it wont keep asking for me for passphrase when I do git push/pull etc.

I use kernel: 6.9.3-3-MANJARO
Cinnamon: 6.0.4

cat ~/.ssh/config
Host *
   AddKeysToAgent yes

.zshrc:

if [ -f ~/.ssh/id_rsa ]; then  # Check if key file exists
    if [ -z "$SSH_AUTH_SOCK" ] ; then  # Check if agent is not running
        eval "$(ssh-agent -s)"  # Start the agent
        ssh-add ~/.ssh/id_rsa  # Add your key
    fi
fi

I think previously on ubuntu I was using keyring for that, but I configured it so long time ago that I dont remember, I have fresh manjaro install.

Thanks!

Check you repo configuration.

If you have cloned using https - you cannot push using ssh.

Hello,

I think you missed some steps. See the last comment here [SOLVED] Use GitHub SSH key without entering username and password / Newbie Corner / Arch Linux Forums

I have ssh, and it uses ssh to fetch, push etc. but I need to enter passphrase for id_isa

I have all off it, I have by previous keys from other PC.

“Now you will only have to enter your password the first time in any session, and it will be cached for the remainder of the session.”

yeah it works fine but as they said, for the session. I want to unblock it on login. Without a need to enter passphrase even 1st time.

You probably have to use something like this git-credential-manager/README.md at main · git-ecosystem/git-credential-manager · GitHub

1 Like

The only way to do that is to create a key without password.

Simply provide an empty string when queried for password.

Or use a keyring. I recommend gnome-keyring-daemon and gcr.

If you’re using cinnamon, I guess that gnome-keyring-daemon is already installed. Also, I guess gcr is also installed, so you only need to activate this daemon:
systemctl --user enable --now gcr-ssh-agent.service

Then, you remove your snippet from the .zshrc file and add this:
export SSH_AUTH_SOCK="${XDG_RUNTIME_DIR}/gcr/ssh"

If other programs should be able to use this key, then put this line into ~/.xprofile instead.

You should reboot afterwards and check if it works.

https://wiki.archlinux.org/title/GNOME/Keyring#SSH_keys

4 Likes

omg! thanks!!
I spent 2 hours already, trying a lot of different things.
It works fine, thank you :slight_smile:

1 Like

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.