ssh-add
ssh-add adds private key identities to the authentication agent, ssh-agent. When run without arguments, it adds the files ~/.ssh/id_rsa, ~/.ssh/id_ecdsa, ~/.ssh/id_ecdsa_sk, ~/.ssh/id_ed25519 and ~/.ssh/id_ed25519_sk. After loading a private key, ssh-add will try to load corresponding certificate information from the filename obtained by appending -cert.pub to the name of the private key file. Alternative file names can be given on the command line.[1]
Documentation
- man 1 'ssh-add' [EN]
Syntax
ssh-add [PARAMETER ...] [FILE ...]
Parameters
- -d
- Instead of adding identities, removes identities from the agent.
- -D
- Deletes all identities from the agent.
- -l
- Lists fingerprints of all identities currently represented by the agent.
- -L
- Lists public key parameters of all identities currently represented by the agent.
- -q
- Be quiet after a successful operation.
- -t LIFETIME
- Set a maximum LIFETIME when adding identities to an agent.
- -x
- Lock the agent with a password.
- -X
- Unlock the agent.
Examples
eval "$(ssh-agent -s)"
ssh-add -q "${HOME}/.ssh/id_ed25519_alex@codeberg"
git push --set-upstream 'origin' 'main'
References
- ↑ Project contributors. "ssh-add(1)." OpenSSH project. https://man.openbsd.org/ssh-add (accessed 18.03.2025)