How to stop SSH from asking for passphrase every time?

Every I use git it asks me for passphrase, even after I start/added the ssh-agent. How do i stop it?

When you create a ssh instance with

ssh-keygen -t ed25519 -C "EXPER"

You will get a prompt asking to enter a pass phrase.
Just hit return, the return again and no pass phrase will be created or needed.

But are you sure you want to not have a pass phrase?

Pudge

1 Like

I’m new to i3, so I don’t know if there’s something else I need to configure, but in others desktop enviroments I only had to type the passphrase once after I activated the agent.

How are you activating the agent and where are you calling got from?

1 Like

Howdy!

This is how I usually do it (for ed25519 and GitHub):

ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C "name/desc <user@email.tld>
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
git config --global core.sshCommand "ssh -i ~/.ssh/id_ed25519 -F /dev/null"

Then add this to ~/.bash_profile (you will be prompted to enter the passphrase everytime you login to your system though):

if [ -z "$SSH_AUTH_SOCK" ] ; then
  eval `ssh-agent -s`
  ssh-add
fi

An alternative option is to use Keychain as manager for the ssh-agent and add this to your ~/.bash_profile. This allows for shells to share a single ssh-agent process.

eval $(keychain --eval --agents ssh --quick --quiet)

By default, the ssh-agent started by keychain is long-running and will continue to run, even after you have logged out from the system.
Quoted source ref: https://linux.die.net/man/1/keychain

Furthermore, in your ~/.ssh/config

Host github
    Hostname ssh.github.com
    Port 443
    User git
    PubKeyAuthentication yes
    IdentityFile ~/.ssh/id_ed25519
    ForwardX11 no
    IdentitiesOnly yes
1 Like

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