Gerrit git clone地址错误:29418

时间:2016-11-02 10:00:27

标签: git gerrit ssh-keys

当我从我的私有Gerrit存储库执行git clone操作时遇到了一个问题,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.

有没有人有任何想法或建议来解决这个问题?谢谢。 (P.S:我使用' localhost'来隐藏真实的IP地址以保护隐私。)

3 个答案:

答案 0 :(得分:0)

尝试git ls-remote ssh://user@localhost:29418/sample-project我认为如果没有一个好的repo文件夹,你会得到同样的错误。也有错误的端口。首先尝试ls-remote与公共仓库,你有权访问和工作..所以我想你不知何故使用错误的主机地址..

答案 1 :(得分:0)

我认为您的 29418 端口未打开。请检查防火墙

答案 2 :(得分:0)

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