Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
gitblit opened this issue Aug 12, 2015 · 5 comments
Closed

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

gitblit opened this issue Aug 12, 2015 · 5 comments

Comments

@gitblit
Copy link
Owner

@gitblit gitblit commented Aug 12, 2015

Originally reported on Google Code with ID 444

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.git)
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)


Reported by gibwar on 2014-06-09 20:55:32

@gitblit
Copy link
Owner Author

@gitblit gitblit commented Aug 12, 2015

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

Reported by James.Moger on 2014-06-09 21:26:12

@gitblit
Copy link
Owner Author

@gitblit gitblit commented Aug 12, 2015

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.

Reported by gibwar on 2014-06-09 21:49:51

@gitblit
Copy link
Owner Author

@gitblit gitblit commented Aug 12, 2015

Yeah, that would probably be safer for tooling integrations.

Reported by James.Moger on 2014-06-09 21:53:11

  • Status changed: Accepted
  • Labels added: Milestone-1.6.0

@gitblit
Copy link
Owner Author

@gitblit gitblit commented Aug 12, 2015

Fix pushed to the release-v1.6.0 stabilizing branch.

Reported by James.Moger on 2014-06-09 22:40:11

  • Status changed: Queued

@gitblit
Copy link
Owner Author

@gitblit gitblit commented Aug 12, 2015

1.6.0 released.

Reported by James.Moger on 2014-06-17 00:24:35

  • Status changed: Done

@gitblit gitblit closed this as completed Aug 12, 2015
@flaix flaix added this to the 1.6.0 milestone Dec 13, 2016
@flaix flaix added this to the 1.6.0 milestone Dec 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants