Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ssh-agent to get key password #171

Closed
DavidGamba opened this issue Sep 17, 2020 · 7 comments · Fixed by #177
Closed

Use ssh-agent to get key password #171

DavidGamba opened this issue Sep 17, 2020 · 7 comments · Fixed by #177

Comments

@DavidGamba
Copy link

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?

@nudgegoonies
Copy link

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.

@xorpaul
Copy link
Owner

xorpaul commented Dec 21, 2020

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?

@nudgegoonies
Copy link

Yes, sounds very good!

@nudgegoonies
Copy link

Any news on this?

@xorpaul
Copy link
Owner

xorpaul commented Mar 11, 2021

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

@nudgegoonies
Copy link

Thank you!

xorpaul added a commit that referenced this issue Mar 31, 2021
xorpaul added a commit that referenced this issue Mar 31, 2021
xorpaul added a commit that referenced this issue Mar 31, 2021
* add module parameter :use_ssh_agent to skip ssh-add before git over SSH commands, fixes #171

* add documentation for :use_ssh_agent git module feature
@xorpaul
Copy link
Owner

xorpaul commented Mar 31, 2021

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

Usage:

mod 'example_module',
  :git => '[email protected]/foo/example-module.git',
  :branch => 'foo',
  :use_ssh_agent => true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants