golang support: 'go get' fails to pull repository over ssh

XMLWordPrintable

    • Type: Suggestion
    • Resolution: Fixed
    • 3.6.0
    • Component/s: None
    • None

      Issue:
      stash git daemon over git+ssh protocol does not close connection on wrong protocol (by client).

      Reproducing:
      curl -v http://your_stash_host:7999/your/stash/repo

      Long description:
      'go get <repo_url>' tries to pull the source code from remote SCM (git, svn, hg, etc) - see http://golang.org/cmd/go/#hdr-Remote_import_paths and 'go get' command description on the same page.

      'go get' fails with git+ssh link. The reason is that 'go get' command tries to guess the protocol for the repository access, and goes in the following order: git, https, http, git+ssh.

      When it tries to guess the protocol, it simply runs 'git ls-remote <scheme>://repo-url'. So in case of Stash repo with git+ssh access, 'go get' will try:
      #1 git ls-remote git://repo-url
      #2 git ls-remote https://repo-url
      #3 git ls-remote http://repo-url
      #4 git ls-remote git+ssh://repo-url

      #1 and #2 fail, and #3 gets stuck, so #4 never executes.
      If I try #3 with curl, it never finishes indeed:

      SFOLSASHAKMAC01: alexkr$ curl -v http://stash1.ops.****.com:7999/skras/httpstore.git

      • Adding handle: conn: 0x7f8269801a00
      • Adding handle: send: 0
      • Adding handle: recv: 0
      • Curl_addHandleToPipeline: length: 1
      • - Conn 0 (0x7f8269801a00) send_pipe: 1, recv_pipe: 0
      • About to connect() to stash1.ops.*****.com port 7999 (#0)
      • Trying 10.22.15.54...
      • Connected to stash1.ops.*****.com (10.22.15.54) port 7999 (#0)
        > GET /skras/httpstore.git HTTP/1.1
        > User-Agent: curl/7.30.0
        > Host: stash1.ops.****.com:7999
        > Accept: /
        >
        SSH-2.0-SSHD-CORE-0.9.0-ATLASSIAN-5
        ^C
        SFOLSASHAKMAC01:alexkr$

      If I try the same to the local SSH port (listening by sshd), curl reports protocol mismatch and connection is immediately terminated by peer (sshd):

      root@g2mgdev1app1:~# curl -v http://localhost:22/

      • Hostname was NOT found in DNS cache
      • Trying 127.0.0.1...
      • Connected to localhost (127.0.0.1) port 22 (#0)
        > GET / HTTP/1.1
        > User-Agent: curl/7.35.0
        > Host: localhost:22
        > Accept: /
        >
        SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2
        Protocol mismatch.
      • Recv failure: Connection reset by peer
      • Closing connection 0
        curl: (56) Recv failure: Connection reset by peer
        root@g2mgdev1app1:~#

            Assignee:
            Unassigned
            Reporter:
            Deleted Account (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: