go-git
go-git copied to clipboard
Respect ~/.ssh/config for host to key mapping
It would be nice if go-git can use the config specified in ~/.ssh/config file to figure out the Auth part of the Clone operation. git
already supports this.
Contents of ~/.ssh/config file
Host bitbucket.org
HostName bitbucket.org
User git
IdentityFile ~/.ssh/bitbucket_key
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/github_key
Is there a reason this isn't implemented? E.g. would you accept a contribution that
- locates and parses a user's $HOME/.ssh/config
- Selects an appropriate ssh key for auth
My team encountered this on CI, where we needed to select a key to push with. CircleCI will automatically write an .ssh/config for the user running in the container, and drop the additional key into the .ssh folder, but go-git doesn't find it automatically.