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

Permanently add all SSH keys to ssh-agent #1062

Closed
svenluijten opened this issue Aug 4, 2016 · 8 comments
Closed

Permanently add all SSH keys to ssh-agent #1062

svenluijten opened this issue Aug 4, 2016 · 8 comments
Labels
👆 Git Upstream issue in Git for Windows.

Comments

@svenluijten
Copy link

Note: I'm by no means an expert in any of the things I'm talking about here, I really just want it to work the way it used to. Any help is appreciated! 😄

Since a recent update, running agent to start up my SSH agent stopped working so I started poking around and I found out I have to uncomment @call "%GIT_INSTALL_ROOT%/cmd/start-ssh-agent.cmd from %CMDER_ROOT%/config/user-profile.cmd, which I did.

To my surprise, this only added my id_rsa file to the SSH agent (is this even the correct terminology?). I have 3 more of my keys in there that I would like to use without having to specify an input file (ssh -i /path/to/file ...) every time I want to establish a new SSH connection. So I guess my question is, how would I go about adding all my SSH keys to the SSH agent when cmder boots up?

@svenluijten svenluijten changed the title Permanently add SSH keys to ssh-agent Permanently add all SSH keys to ssh-agent Aug 4, 2016
@jankatins
Copy link
Contributor

jankatins commented Aug 8, 2016

cmder only documents what's already available in the git package. The file is included in the git-for-windows package from the mingw packages: https://github.com/git-for-windows/MINGW-packages/blob/master/mingw-w64-git/start-ssh-agent.cmd

As far as I understand that file, it simply does a ssh-add call. According to the docs, it only auto loads certain keyfiles:

ssh-add adds private key identities to the authentication agent, ssh-agent(1). When run without arguments, it adds the files ~/.ssh/id_rsa, ~/.ssh/id_dsa, ~/.ssh/id_ecdsa and ~/.ssh/identity.

I guess one idea would be to copy the start-ssh-agent.cmd script to a user controlled place and change that line to also list all keyfiles ssh-add should load: @"!SSH_ADD!" ~/.ssh/key1 ~/.ssh/key2.

Or do a manual ssh-add ~/.ssh/your-other-key ~/.ssh/yet-another-keyfile in one session and have it available in all other cmder sessions.

Or change the start-ssh-agent script to add a way to add more than one keyfile and submit a PR there :-)

@svenluijten
Copy link
Author

Ah that should be plenty of options to try out @JanSchulz, thanks for the reply! 😄

@jankatins
Copy link
Contributor

See git-for-windows/MINGW-packages#18 for a PR adding it upstream... If that is accepted, you can set "SSH_ADD_ADDITIONAL_KEYFILES=keyfile1_rsa,keyfile2_rsa2" before the start-ssh-agent call and get you additional keys...

@svenluijten
Copy link
Author

Awesome, thanks for that! Let's hope it gets merged 🙏

@jankatins
Copy link
Contributor

jankatins commented Aug 8, 2016

@svenluijten It would be nice if you could try that PR: simply save the complete file from https://github.com/janschulz/MINGW-packages/blob/ea4dad14da8e7ad60c7b2e7eaaef9e138b7da563/mingw-w64-git/start-ssh-agent.cmd in <cmder>\bin, set the additional keyfiles, kill the ssh-agent and restart cmder (or start-ssh-agent).

@svenluijten
Copy link
Author

@JanSchulz I'll do that once I have access to my PC at home later today 👍

@Stanzilla Stanzilla added the 👆 Git Upstream issue in Git for Windows. label Aug 8, 2016
@jankatins
Copy link
Contributor

It seems the new git version and in particular the included openssh version has some other means to get a solution working: git-for-windows/MINGW-packages#18 (comment)

@Stanzilla
Copy link
Member

Oh neat

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

No branches or pull requests

3 participants