Using custom ssh-agent for communicating with Github

632 views Asked by At

I inherited a deployment system that is currently broken and I'm at a loss at how to fix it.

The basic setup is adding 3 keys to ssh-agent and pulling a few private repos from Github via the Go deployment software from ThoughtWorks.

I seem to need to have one ssh-agent running that can be accessed by multiple user accounts.

I've started a ssh-agent and added the keys to it and then I was able to clone private repos from the command line without issue, but when the main application( which is using the same user account ) tries to clone it fails with a permission denied error.

My guess is that the ssh-agent that is holding the keys is not accessible to the application for some reason.

Here are the instructions that I have:

  • export SSH_AUTH_SOCK=/var/go/ssh-agent.sock
  • ssh-add ~/.ssh/go_deploy_id_rsa
  • ssh-add ~/.ssh/go_id_rsa
  • ssh-add ~/.ssh/deploy_id_rsa

When I set the SSH_AUTH_SOCK environment variable it seems to kill any ssh-agent that is/was running and when I issue the ssh-add command I get the classic:

"Could not open a connection to your authentication agent."

So basically how do I start ssh-agent AND have it use the SSH_AUTH_SOCK I defined earlier and stay running so that the Go application uses it when it communicates with Github?

This use to work so I know that the setup is technically valid.

SOLVED: It turns out the ssh-agent socket that I was using was stale. Deleting the socket and re-creating it allowed the keys to be added and communication worked again.

0

There are 0 answers