2841: Using non-standard ssh port (!=22) for connecting to git repository

mario******@gmai***** (Google Code) (Is this you? Claim this profile.)
March 3, 2013
What version are you running?


What's the URL of the page this enhancement relates to, if any?


Describe the enhancement and the motivation for it.

Company's Collabnet TeamForge installation is running ssh server for git on port different than 22 it seams that it is not supported if repository path is defined like this: ssh://user@server:port/gitrepopath

Please provide any additional information below.

It seams that GitClient class in scmtools/git.py does not even parse port part properly:

    schemeless_url_re = re.compile(

On the other end, it seams that paramiko supports non-standard ports properly.

I would create patch myself but I'm still struggling with understanding python and I'm still far from coding using it.

#1 mario******@gmai***** (Google Code) (Is this you? Claim this profile.)
After some more digging, I actually found that the problem is not with schemeless_url_re.

Problem seams to be usage of urlparse.urlparse which doesn't differentiate hostname and port in netloc:

    Parse a URL into 6 components:
    Return a 6-tuple: (scheme, netloc, path, params, query, fragment).
    Note that we don't break the components up in smaller bits
    (e.g. netloc is a single string) and we don't expand % escapes.

Easy workaround could be to modify check_host method in ssh/utils.py to split netloc in hostname and port as in attached patch created against release-1.7.x branch.

When I tried this change, I noticed that connection has been successfully established to my git server but something else went wrong that I don't understand (attached screenshot and logfile). Any help would be appreciated.

  • +
    [Thu Jan 03 14:59:43 2013] [error] /usr/lib/python2.6/site-packages/django/views/generic/list_detail.py:10: DeprecationWarning: Function-based generic views have been deprecated; use class-based views instead.
    [Thu Jan 03 14:59:43 2013] [error]   DeprecationWarning
    [Thu Jan 03 15:59:44 2013] [error] /usr/lib/python2.6/site-packages/django/conf/__init__.py:75: DeprecationWarning: The ADMIN_MEDIA_PREFIX setting has been removed; use STATIC_URL instead.
    [Thu Jan 03 15:59:44 2013] [error]   "use STATIC_URL instead.", DeprecationWarning)
    [Thu Jan 03 15:59:44 2013] [error] DEBUG:root:Logging to /var/www/reviewboard/logs/reviewboard.log with a minimum level of DEBUG
    [Thu Jan 03 15:59:44 2013] [error] 2013-01-03 15:59:44,129 - DEBUG - Logging to /var/www/reviewboard/logs/reviewboard.log with a minimum level of DEBUG
    [Thu Jan 03 15:59:44 2013] [error] DEBUG:root:GitTool: Attempting ssh connection with host: <myhost>:<myport>, username: <myuser>
    [Thu Jan 03 15:59:44 2013] [error] 2013-01-
#2 mario******@gmai***** (Google Code) (Is this you? Claim this profile.)
Patch submitted for review: http://reviews.reviewboard.org/r/3712/
#3 david
  • +PendingReview
  • +Component-SSH
#4 mario******@gmai***** (Google Code) (Is this you? Claim this profile.)
Solved and verified by submitted patch. Adding git over ssh on non standard port works now. I will check full functionality next week.
#6 chipx86
Fixed on release-1.7.x (d3277d)
  • -PendingReview
  • +chipx86