davideuler / gitblit

Automatically exported from code.google.com/p/gitblit
Apache License 2.0
0 stars 0 forks source link

Clone repository links broken when using default SSH port 22. #444

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Install Gitblit 1.5.1 WAR on Tomcat 7.0.54 using Java JDK 7u55 on Windows.
2. Change git.sshPort to 22. (since there is no system SSH daemon)
3. Change git.acceptedPushTransports to HTTPS SSH.
4. Visit an empty repository (url: 
?wicket:bookmarkablePage=:com.gitblit.wicket.pages.EmptyRepositoryPage&r=test.gi
t) on any browser 
5. Click on any of the default drop down links.

What is the expected output? What do you see instead?
The SSH clone link should have ssh://user@server/path/to/repo.git (e.g. 
SourceTree SSH link should point to 
sourcetree://cloneRepo/ssh://user@server/test.git, git link poitns to git clone 
ssh://user@server/test.git).

Instead, if the default port is used, the ssh:// protocol is stripped and the 
generated links are broken in their respective source program (e.g. SourceTree 
SSH link (on port 22) points to sourcetree://cloneRepo/user@server/test.git, 
git link points to git clone user@server/test.git)

This does not appear to affect HTTPS links (those show fine), but SSH links 
with port 22 are broken. Picking any other port generates the proper link with 
the port included: git clone ssh://user@server:23/test.git.

What version of the product are you using? On what operating system?
Gitblit WAR 1.5.1 (clean installation with only basic customizations applied to 
the gitblit.properties file, directed by the baseFolder <Envrionment> directive 
in CATALINA_BASE\conf\context.xml.)

Tomcat 7.0.54, 64-bit - configured to use APR for HTTPS, port 443. No HTTP or 
AJP ports open.
Java JDK 7 update 55
> java version "1.7.0_55"
> Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
> Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode)

Windows 7 64-bit SP1 (6.1.7601 Service Pack 1 Build 7601)

Original issue reported on code.google.com by gib...@gmail.com on 9 Jun 2014 at 8:55

GoogleCodeExporter commented 9 years ago
Port 22 is a special case for the ssh url.  It follows the shortened url 
pattern documented here [1] and in-use on GitHub.  I haven't tested SourceTree 
with this URL pattern so if you tell me it doesn't work, then I believe you.  
Native git clients should be able to clone that url just fine.  I don't have a 
problem forcing the ssh:// protocol to always be generated, but have you 
confirmed that it fails?  Or do you suspect that it fails?

[1]; https://www.kernel.org/pub/software/scm/git/docs/git-clone.html

Original comment by James.Mo...@gmail.com on 9 Jun 2014 at 9:26

GoogleCodeExporter commented 9 years ago
Referencing the GIT URLS section of the git-clone manual page indicates that 
the protocol-less version is an alternative scp-like syntax. However, the 
syntax needs to have a colon between the host and the path and not a slash as 
in the ssh:// URL.

  git clone user@server:path/to/repo   -or-
  git clone ssh://user@server/path/to/repo

I've confirmed that attempting a
  git clone user@server/test.git
on Windows using Git 1.9.2 returns
  fatal: repository 'user@server/test.git' does not exist

Either solution would be fine, though I think it would be a little easier to 
just force "ssh://" in front of the URL rather than attempt the SCP syntax in 
the special case of port 22.

Original comment by gib...@gmail.com on 9 Jun 2014 at 9:49

GoogleCodeExporter commented 9 years ago
Yeah, that would probably be safer for tooling integrations.

Original comment by James.Mo...@gmail.com on 9 Jun 2014 at 9:53

GoogleCodeExporter commented 9 years ago
Fix pushed to the release-v1.6.0 stabilizing branch.

Original comment by James.Mo...@gmail.com on 9 Jun 2014 at 10:40

GoogleCodeExporter commented 9 years ago
1.6.0 released.

Original comment by James.Mo...@gmail.com on 17 Jun 2014 at 12:24