How to enable ssh-agent?
I'm trying to setup Cmder to use ssh-agent forwarding:
λ ssh-agent SSH_AUTH_SOCK=/tmp/ssh-JqBCMa6092/agent.6092; export SSH_AUTH_SOCK; SSH_AGENT_PID=7840; export SSH_AGENT_PID; echo Agent pid 7840;
λ ssh-add my-public-key.pub Could not open a connection to your authentication agent
Any ideas what I'm doing wrong here?
Thank!
same problem here, if someone is using this without problems i would appreciate a hint on how to set it up.
I came up with this gist, which does the trick: https://gist.github.com/bojanrajkovic/6997145eda613467ace4. You can add this to init.bat. I'd love some input from @bliker or someone else as to how to get this to run on "startup" without being overwritten by Cmder upgrades.
Sweeet! Works as advetised :-)
I would even go as far as making this an official option (perhaps not default, but an option nonetheless!)
I wrote another solution for the problem which doesn't run ssh-agent for each new Cmder instance.
It works without temporary files, only runs ssh-agent when it isn't running and adds ssh keys in %HOME%.ssh*_rsa if they were not yet added.
https://gist.github.com/Shoozza/8fe8b0c85fa89cd3b1c4
Nice, that's much better than my hack. I've switched to Powershell + posh-git in the meantime (which has built-in support for ssh-agent), but this is a cool solution.
Using the script from @bojanrajkovic it works for me. With @Shoozza's fix I only get: "Could not open a connection to your authentication agent". Strange, I don't see why the call to ssh-add shouldn't work in the second script as well.
I get the same with @Shoozza 's fix also: Could not open a connection to your authentication agent. Would be nice to resolve as it's a cleaner workaround for this issue.
Rewrote the script to handle the issue (revision 7). The problem was that another ssh-agent was running already and didn't use the /tmp/ssh-agent.sock. @ogrim @rmorrin
Thanks, @Shoozza. It's working fine for me now :+1:
@ogrim Same for me - thanks @Shoozza! Is there a way to automatically run this each time a new Cmder window/tab is opened?
You can add it to cmder/vendor/init.bat. I have the script on my path as agent.cmd, so I have only added call agent as the last line in init.bat
I added @call "%CMDER_ROOT%/vendor/agent.cmd" at the end of cmder/vendor/init.bat.
@ogrim @Shoozza Thanks, exactly what I was looking for! This has been a huge headache for me with Cmder for a long time - you should definitely submit a PR :+1:
@Shoozza Cheers, this is fantastic.
This need to be added to the repo !
I'm taking the liberty of notifying @bliker directly. I hope he doesn't mind. This shoud be part of cmder for sure :D
If someone adds a pull request to add the file there shouldn't be a problem.
I went ahead and made pull request #351, thanks everyone!
Based on your great solution, a script which loads keys into putty's pageant. https://gist.github.com/teleivo/2eb7dd6afbda414c9269
Same as above add @call "%CMDER_ROOT%/vendor/pageant_autostart.cmd" at the end of cmder/vendor/init.bat
pageant helps those who want to use vagrant on windows with puppets vcsrepo to clone private git repos: https://github.com/mitchellh/vagrant/issues/1735
thanks a lot for cmder :)
It is working for me but the agent forwarding is not good How to export SOCK and PID variable?