[How2Tips] How to use your local private keys through SSH?

Published on

Oct 24, 2017

how2tips

Let’s say you want to perform an action that requires some specific SSH authentication, through an SSH connection. For example, you want to clone a private Git repository from a remote server. Problem: this server does not have the right credentials to pull from this repository.

The solution: forward your ssh-agent

  • Make sure your ssh-agent is ready: eval $(ssh-agent)
  • Add your private key: ssh-add ~/.ssh/id_rsa (or if you want to add each of your keys: ssh-add)
  • Now, ensure your key is visible to the ssh-agent: ssh-add -L

That’s it! Next time you will use your SSH client, it will communicate through your ssh-agent and provide the given keys. Note: you’ll have to do that for every Bash instance. If you want to start an ssh-agent automatically and avoid having to setup manually every time, you can visit the following links:

This article is from our internal knowledge base, we wanted to share it with you. ❤ Send us a KUDO-Tweet if this article has helped you !

Written by

Yann Rabiller
Yann Rabiller

Comments