go-git icon indicating copy to clipboard operation
go-git copied to clipboard

Respect ~/.ssh/config for host to key mapping

Open swarupdonepudi opened this issue 5 years ago • 1 comments

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

swarupdonepudi avatar Sep 23 '19 20:09 swarupdonepudi

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.

dontlaugh avatar Nov 27 '19 16:11 dontlaugh