israelroldan / grunt-ssh

SSH, SFTP tasks for Grunt.
https://npmjs.org/package/grunt-ssh
MIT License
244 stars 70 forks source link

Use ssh -A option #71

Open yannissgarra opened 10 years ago

yannissgarra commented 10 years ago

Hi ! When I connect my server, I use ssh -A option like this : ssh -A yannis@myserver.dom

This allows me to send my private key through ssh and I can pull from git repository, directly from server, with my private key.

How can I do this with grunt-ssh ?

Many thanks !

justinklemm commented 10 years ago

Yannis tweeted to me in regards to this issue too, because I used grunt-ssh in a tutorial of mine. I happen to see this issue while researching.

It looks like the underlying ssh2 package does support forwarding via an "agentForward" option. You can see it here: https://github.com/mscdex/ssh2

The documentation says it's defaulted to false, so we just need a way to override this in the grunt-ssh options. Can we simply add an agentForward property below this line? https://github.com/andrewrjones/grunt-ssh/blob/master/tasks/sshexec.js#L30

It could be defaulted to false so that current behavior is not changed, but it would give us the option to leverage this ability of ssh2.

I'm happy to test this and send a pull request. Let me know. Thanks!