- **Epistemic status:** #evergreen
![[ssh-agent.svg]]When you [[Generate new SSH key pairs]], you can add the key to the ssh-agent to not have to re-enter the passphrase each time you need to authenticate. The ssh-agent is available on operating systems such as [[Linux]], Mac, and Windows.
> Note - For Windows you can use [Git Bash](https://git-scm.com/) to simplify the process
1. Open your terminal and type or paste the following command to start the ssh-agent in the background.
```shell
$ eval "$(ssh-agent -s)"
```
> Note - Depending on the environment you might run into issues and might need to run a different command.
The command will output an id of the process. This number can differ from the one shown here.
```shell
> Agent pid 59566
```
2. The next step is to add the private key to the ssh-agent. Depending on the name and location of your key, replace the values on the following command:
**Windows/Linux**
```shell
$ ssh-add ~/.ssh/<private_key_file>
```
**Mac**
```shell
$ ssh-add -K ~/.ssh/<private_key_file>
```
The first time you do this it will ask for your passphrase, and after it is confirmed, you won't have to do it again.
---
## References
- GitHub Docs. “Generating a New SSH Key and Adding It to the Ssh-Agent.” Accessed November 22, 2021. <https://docs.github.com/en/
[email protected]/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent>.
- “Git.” Accessed October 20, 2021. <https://git-scm.com/>.
- “Ssh-Agent(1) - Linux Manual Page.” Accessed November 22, 2021. <https://www.man7.org/linux/man-pages/man1/ssh-agent.1.html>.
- GitHub Docs. “Working with SSH Key Passphrases.” Accessed November 8, 2021. <https://docs.github.com/en/
[email protected]/authentication/connecting-to-github-with-ssh/working-with-ssh-key-passphrases>.