xorpaul/g10k

Use ssh-agent to get key password

DavidGamba opened this issue · 7 comments

I am trying to use the option to clone repositories with an SSH key that has a password.

The key is already in my ssh-agent. Can the clone be done using that key?

Same problem here. Having two SSH Keys, both are loaded, and git commands for repositories via ssh work flawless.

But g10k first brings a graphical dialog for my first key and then asks in the console for the second key and then in loop for further repos until i gave up.

Maybe this ticket is related because we also have this kind of internal modules too "mod '$NAME', :git => 'ssh://git@$SERVERNAME':
#62
But in contrast to this ticket we use git via ssh and ssh and git via ssh works otherwise with the exception of g10k.

Yeah, this happens because g10k tries to add/load the SSH key before each git command targeting a non http repository URL, see

g10k/git.go

Line 119 in fe43a33

er = executeCommand("ssh-agent bash -c 'ssh-add "+gitModule.privateKey+"; "+gitCmd+"'", config.Timeout, gitModule.ignoreUnreachable)

I could add a parameter to the g10k config where the SSH key is specified, so that g10k should not do the above and simply trusts that the user already added the SSH key to an SSH agent.

Sounds good?

Yes, sounds very good!

Any news on this?

Nope, but it's not forgotten. Give me a little bit more time and I'll come back with a solution.

Thank you!

Checkout https://github.com/xorpaul/g10k/releases/tag/v0.8.13

Usage:

mod 'example_module',
  :git => 'git@somehost.com/foo/example-module.git',
  :branch => 'foo',
  :use_ssh_agent => true