3

I spent about 20 minutes messing around with this problem.

I was emailed an SSH address for a repository. Crucially it had a non-standard (i.e. not 22) port number: git@domain.com:1234/opt/git/repository.git

I assumed I could just copy-paste that into SourceTree, but kept getting This is not a valid source path / URL error messages.

When I took a closer look at the logs, the error was that it was looking for the path 1234/opt/git/repository.git on the server - it was treating the port number as part of the path. And obviously not finding the repo.

yellow-saint
  • 884
  • 2
  • 13
  • 37

1 Answers1

6

The solution was slightly weird:

  1. Use a path like ssh://git@domain.com:1234:/opt/git/repository.git. Appending ssh://, and adding a : after the port number seemed to successfully act as a delimiter, and the path /opt/git/repository.git was found (as expected) on the server.
  2. Add the domain/port number to your config file (e.g. ~/.ssh/config) so that it looks like this:

Host domain.com Port 1234

yellow-saint
  • 884
  • 2
  • 13
  • 37
  • 4
    I tried your answer on my Synology NAS running a Git Server. However, I had to delete the ':' after the port number in order to have a working URL. Therefore, with me it was (using your example): ssh://git@domain.com:1234/opt/git/repository.git – Peter Nov 19 '16 at 11:28
  • 1
    Same situation as reported by @Peter. – Syrtis Major Oct 21 '18 at 17:08