SourceTree cannot clone git repo when using recent openssh
Asked by St?phane Bouchard [RhCan]:

Hi,

I need to use latest OpenSSH from cygwin because the openssh include in msysgit are causing problem for unknown reason with our VPN (Checkpoint VPN). I installed the latest cygwin and overwrite openssh binary and dependencies into the git/bin installation folder. Everything work fine and it's faster then before to clone our repository. But it's not working in SourceTree. Its successfully from the command line (Git Bash), from GitExtension and TortoiseGit.

When I try to clone, I get in the "Repository Type" status this message : This is not a valide source path / URL.

=====

In the details... :

fatal: remote error: Remote URL invalid

A repository could not be determined from the remote URL. Please confirm the clone URL in stash and try again. URL suggix: 'C:/Program Files (x86)/Git/issp/issp.git'

fatal: Could not read from remote repository.

Please make sure you have the correct access rights

and the repository exists.

=====

The openssh version that came from original installation is : OpenSSH_4.6p1

and the version from cygwin is : OpenSSH_6.2p2. I try with OpenSSH_5.9p1 and I get the same problem.

Why SourceTree have this behaviour? How can I fix this problem?

Thanks,

--

St?phane


Answers:
author: St?phane Bouchard [RhCan]
body: The solution to my issue with SSH and GIT on Windows with our McAfee and Checkpoint VPN was fix by using Putty instead of openssh that came with MsysGit. For some obscure reason the combinaison of these product do not work in our infrastructure.

Using Putty is not a bad choice either.

Thanks for your help.


author: St?phane Bouchard [RhCan]
body: Yes I copy all the ssh utilities from cygwin and all the Cygwin DLL. Like I said, it work perfecly from the command line, from GitExtension, from TortoiseGit, from CollabNet GitEye. But it's not working in Source Tree. It look to me that it's only the Repository Type validation during the "Clone" operation. Source Tree is not able to validate the Git repo. Maybe the problem is the path that Cygwin use. Can I run SourceTree in debug mode (or verbose) to see what is the error?

All the other SourceTree operation is working well. It's only the operation clone/fetch/pull/push.

I really like to work with SourceTree for my Git client and the git-flows. But is is a blocker right now. Thanks for helping me on this.

comments: author: stevestreeting
body: The 'Details' button is really all of the output that's available, basically we just call 'git ls-remote URL' in order to validate the URL. I mentioned above that SourceTree has to run ssh-add and ssh-agent from the Git bin directory too, in order to hook up your SSH keys, did you make sure that you'd installed updated versions of those too and re-started SourceTree afterwards?


author: St?phane Bouchard [RhCan]
body: It's look like you gave me a good hint. In fact, the ssh-add and ssh-agent are updated with all the dependencies. But for unknown reason the ssh-agent process terminate. I am not able to see the content of the window to diagnose the problem. I want to call the ssh-agent/ssh-add process from my command prompt. It is possible to know the syntax of the SourceTree call?

Thanks.


author: stevestreeting
body: Sure, SourceTree does this:

1. Calls "ssh-agent" with no params, and reads back the "SSH_AUTH_SOCK" and "SSH_AGENT_PID" values so it can provide them to future calls
2. Calls "ssh-add keyfile", with a calling environment populated with those SSH_\* variables so it can communicate with the agent. It actually calls ssh-add through 'cmd' as a wrapper though, this is so that it opens a terminal window that you can type your passphrase into if the key has a passphrase (which is recommended). So the actual call is more like:   

   ```
   cmd /C "path\to\ssh-agent path\to\key"
   ```

   Both the ssh-agent and key paths are also re-quoted if they have spaces in their paths.

Another small nuance - we actually use an intermediate wrapper, for ssh-add, you can find it in %SourcetreeInstallPath\\tools\\openssh_add.cmd. It's only purpose is to add some text in the terminal that gets launched to explain why you're getting this window popping up - it just calls ssh-add right after.


author: stevestreeting
body: SourceTree just calls the command line git anyway, and if you've updated the ssh binaries in-place it should work the same way. However SourceTree does also call ssh-add and ssh-agent in order to set up your key authentication, have you updated those binaries too to match?


Tags: ssh