Home > database >  How to `go get` private repos using SSH key auth with password
How to `go get` private repos using SSH key auth with password

Time:10-23

I usually set a passphrase in my ssh keys so that, in case of it gets compromised, I might get some time to rotate to a new one.

However, when working with go modules, I noticed that when executing a go get and making use of keys with passphrase, I get the error below

[email protected]: Permission denied (publickey).

Is there any way to be prompted for this password when resolving dependencies in Go?

For now, I removed the password :(

CodePudding user response:

use an agent. On Linux or Macos the process is

   ssh-agent bash

this first step starts a shell with ssh-agent

   ssh-add ~/.ssh/id_rsa

the second step adds a key to the agent, ~/.ssh/id_rsa is the path to the key. After this step it will ask once for the passphrase

Once you've done these things any command in the new shell will use the keys loaded with ssh-add

  • Related