Bug 2736 - NGit needs integration with ssh-agent
Summary: NGit needs integration with ssh-agent
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Version Control ()
Version: Trunk
Hardware: PC Mac OS
: Normal normal
Target Milestone: master
Assignee: Alan McGovern
Depends on:
Reported: 2012-01-04 13:54 UTC by Alan McGovern
Modified: 2015-08-20 03:23 UTC (History)
4 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Alan McGovern 2012-01-04 13:54:08 UTC
If a user has added an sshkey to ssh-agent, we should use it. See this bug:

Comment 1 Marius Ungureanu 2014-09-07 23:19:31 UTC
There is ssh-agent support in libgit2. It will be implemented.
Comment 2 Marius Ungureanu 2014-11-10 13:45:21 UTC
Fixed in libgit2.
Comment 3 Parmendra Kumar 2015-05-05 11:53:32 UTC

To verify this issue, I have tried to reproduce it and unable to reproduce it.
Could you please provide us some steps? so that we can reproduce it at our end.

Comment 4 Marius Ungureanu 2015-05-05 12:02:58 UTC
This should be only tested on Mac.

Testing this is as follows:

1. Generate a ssh key with ssh-keygen and add it on github (https://help.github.com/articles/generating-ssh-keys/)

2. Add the key to ssh-agent (See the mac guide at the bottom of this link: https://developer.github.com/guides/using-ssh-agent-forwarding/)

3. Move the id_rsa.pub and id_rsa files out of ~/.ssh. In a terminal, you can type: mv ~/.ssh/id_rsa* ~/

4. Try checking out a repository using the SSH url to checkout and see that there was no request for a ssh key and it checked out successfully.
Comment 5 Parmendra Kumar 2015-05-06 08:38:50 UTC
Thanks @Marius

I have checked this issue as per comment #4 and I am successfully able to generate a SSH keys. 
But I am sure how to generate SSH url as steps 4 in comment #4. Could you please tell me how to generate a  SSH url?

Please follow the screencast: http://www.screencast.com/t/gneYJECrI ,  and let me know if I have missed anything.
Comment 6 Marius Ungureanu 2015-05-06 09:00:28 UTC
You do not have to append the ssh://. Do not touch the dropdown. Just paste in the URL you pasted.
Comment 7 Parmendra Kumar 2015-05-06 09:26:46 UTC

If I don't select the ssh, I am getting a Authenticating error

Screencast for the same: http://www.screencast.com/t/nHDvg632RBKe
Comment 8 Marius Ungureanu 2015-05-08 08:42:15 UTC
Are you sure you've followed step #2 from comment #4? It works for me locally.
Comment 9 Parmendra Kumar 2015-05-08 12:13:23 UTC

I have recheck this issue as per comment #4  and observed that I am successfully able to follow steps 1 but step 2 I am getting issue with command $ ssh -v example.com. I ma using $ ssh -v github.com and its throw :
debug1: No more authentication methods to try.
Permission denied (publickey).

Please follow the github and screencast and let me know if I have missed anything.

Terminal command: https://gist.github.com/Parmendrak/3598b00ef4cd247058fb

Screencast: http://www.screencast.com/t/EovYRqsGq

Comment 10 Marius Ungureanu 2015-05-08 13:36:57 UTC
Okay, so:

1. Make sure you've set up everything with:

$ ssh-keygen
$ ssh-add ~/.ssh/id_rsa
$ pbcopy < ~/.ssh/id_rsa.pub

2. Set up the ssh key on github.com

3. Then try out ssh -v git@github.com

4. Attempt to clone a repository with XS.
Comment 11 Marius Ungureanu 2015-05-08 13:49:54 UTC
Okay so, the screencast I'm showing is as follows:

I'm using a ssh key added in the agent. Then I'm attempting to clone an URL using a ssh connection and showing that through code stepping, it's going through the ssh agent code.


Can mark this as resolved fixed?
Comment 12 Parmendra Kumar 2015-05-08 14:30:04 UTC
Thanks @Marius

I have checked this issue as per you instruction provided me in comment #10, and here are my observation 

1.  I am successfully  able to create a clone on my computer with command (git clone git@github.com:Parmendrak/Parmendra5.git)
2. If I open the cloned project on XS and commit the changes it asked for SSH Key

Screencast: http://www.screencast.com/t/gLNCDF4eF

3. If I checkout in XS (version control->checkout) it asked for SSH key

Screencast: http://www.screencast.com/t/bn8eaBtHuw

Terminal Command gist: https://gist.github.com/Parmendrak/4151c72a8cf0c9d681f7

Please let me know if I have missed anything.
Comment 13 Marius Ungureanu 2015-05-08 14:33:16 UTC
Yeah, moving the ssh key wasn't supposed to be in that list of commands. I was thinking of another test case, my mistake.

Basically, do not execute mv ~/.ssh/id_rsa ~/
Comment 14 Parmendra Kumar 2015-05-08 15:02:12 UTC
I have used the command as per you provided me in comment #13

ShrutiMac:~ 360_macmini$ mv ~/.ssh/id_rsa ~/
mv: /Users/360_macmini/.ssh/id_rsa: No such file or directory

After run the above command I am able to see the "id_rsa" and "id_rsa_pub" file on 360_macmini folder.

Screencast: http://www.screencast.com/t/5qCde9IhejA

Could you please tell me should I remove these file?
Comment 15 Marius Ungureanu 2015-05-08 15:15:43 UTC
You need to move them back. Do not run that command. Repeat all the steps:

ssh-keygen, ssh-add, add the ssh key on github and clone the repo.
Comment 16 Manish Sinha 2015-05-08 15:27:42 UTC
I verified it and it works

Permendra, here is how I did (for future reference)

I checked that ssh-agent had my key and then I moved the key store directory

$ ssh-add -l
4096 dd:62:ca:0b:62:35:eb:50:62:fe:51:19:0f:33:9d:3e /Users/manish/.ssh/id_rsa (RSA)
$ mv ~/.ssh/ ~/.ssh2/

then I got the XS build with libgit2 and then checkedout any repo with ssh protocol

It worked since ssh-agent already had the key it needed.