Gerrit git克隆错误地址:29418



我遇到了一个问题,当我从我的私有Gerrit存储库进行git克隆操作时,Gerrit服务器响应我以下错误:

$ git clone -v ssh://user@localhost:29418/sample-project
Cloning into 'sample-project'...
ssh: connect to host localhost port 29418: Bad address
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

但是,我仍然可以正确地执行命令git review。下面是我的执行历史记录:

user@user-PC MINGW64 ~
$ ssh -p 29418 -v user@localhost gerrit
OpenSSH_7.1p2, OpenSSL 1.0.2h  3 May 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to localhost [localhost] port 29418.
debug1: Connection established.
debug1: identity file /c/Users/user/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/user/.ssh/id_rsa-cert type -1
debug1: identity file /c/Users/user/.ssh/id_dsa type 2
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/user/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/user/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/user/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/user/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/user/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.1
debug1: Remote protocol version 2.0, remote software version GerritCodeReview_2.11 (SSHD-CORE-0.14.0)
debug1: no match: GerritCodeReview_2.11 (SSHD-CORE-0.14.0)
debug1: Authenticating to localhost:29418 as 'user'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-sha1 none
debug1: kex: client->server aes128-ctr hmac-sha1 none
debug1: sending SSH2_MSG_KEXDH_INIT
debug1: expecting SSH2_MSG_KEXDH_REPLY
debug1: Server host key: ssh-rsa SHA256:Rk2to0JI8M57vEwLrH3dHQhw+B/s0fdERul+y93s37c
debug1: Host '[localhost]:29418' is known and matches the RSA host key.
debug1: Found key in /c/Users/user/.ssh/known_hosts:1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /c/Users/user/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Authentication succeeded (publickey).
Authenticated to localhost ([localhost]:29418).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: Sending command: gerrit
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
Available commands of gerrit are:
   apropos              Search in Gerrit documentation
   ban-commit           Ban a commit from a project's repository
   close-connection     Close the specified SSH connection
   create-account       Create a new batch/role account
   create-branch        Create a new branch
   create-group         Create a new account group
   create-project       Create a new project and associated Git repository
   flush-caches         Flush some/all server caches from memory
   gc                   Run Git garbage collection
   gsql                 Administrative interface to active database
   logging
   ls-groups            List groups visible to the caller
   ls-members           List the members of a given group
   ls-projects          List projects visible to the caller
   ls-user-refs         List refs visible to a specific user
   plugin
   query                Query the change database
   receive-pack         Standard Git server side command for client side git push
   rename-group         Rename an account group
   review               Apply reviews to one or more patch sets
   set-account          Change an account's settings
   set-members          Modify members of specific group or number of groups
   set-project          Change a project's settings
   set-project-parent   Change the project permissions are inherited from
   set-reviewers        Add or remove reviewers on a change
   show-caches          Display current cache statistics
   show-connections     Display active client SSH connections
   show-queue           Display the background work queues
   stream-events        Monitor events occurring in real time
   test-submit
   version              Display gerrit version
See 'gerrit COMMAND --help' for more information.
谁有什么想法或建议来解决这个问题?谢谢。(注:我使用'localhost'来隐藏真实的ip地址,以保护隐私)

试试git ls-remote ssh://user@localhost:29418/sample-project,我认为没有一个好的repo文件夹,你会得到同样的错误。端口也错了。先尝试ls-remote和一个你可以访问和工作的公共仓库。所以我觉得你用错主机地址了

我认为你的端口29418没有打开。请检查防火墙

最后,我解决了这个问题。我的解决方案是使用旧版本的"git-bash for windows(32位版本)",而不是最新版本(64位,2.10.2)。例如,我使用的是1.8版本。X,这对我很有效。https://github.com/git-for-windows/git/tags?after=v1.9.0

最新更新