git - 从 gitlab 克隆 repo 的问题(致命的 : The remote end hung up unexpectedly)

标签 git apache ssh clone gitlab

制作时:

sudo git clone git@gitlab.mydomain.com:ws.git

我得到一个错误:

> sudo git clone git@gitlab.mydomain.com:root/ws.git
Password:
Cloning into 'ws'…
The authenticity of host 'gitlab.mydomain.com (x.x.x.x)' can't be established.
RSA key fingerprint is xx:xx:xx…xx:xx.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'gitlab.mydomain.com,x.x.x.x' (RSA) to the list of known hosts.
git@gitlab.mydomain.com's password: 
Permission denied, please try again.
git@gitlab.mydomain.com's password: 
fatal: 'root/ws.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

即使我更改了 url:

> sudo git clone git@gitlab.mydomain.com:ws.git
Password:
Cloning into 'ws'…
git@gitlab.mydomain.com's password: 
fatal: 'ws.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

问题是什么?

是公共(public)克隆的问题吗?我可以只克隆添加个人 ssh key 吗?

更新:

添加了个人 ssh key :

现在:

ssh -Tvvv root@gitlab.mydomain.com
OpenSSH_5.6p1, OpenSSL 0.9.8x 10 May 2012
debug1: Reading configuration data /Users/user/.ssh/config
debug1: Applying options for gitlab.mydomain.com
debug1: Reading configuration data /etc/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to gitlab.mydomain.com[x.x.x.x] port 22.
debug1: Connection established.
debug3: Not a RSA1 key file /Users/user/.ssh/root_gitlab.mydomain.com.
debug2: key_type_from_name: unknown key type '-----BEGIN'
debug3: key_read: missing keytype
debug2: key_type_from_name: unknown key type 'Proc-Type:'
debug3: key_read: missing keytype
debug2: key_type_from_name: unknown key type 'DEK-Info:'
debug3: key_read: missing keytype
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug2: key_type_from_name: unknown key type '-----END'
debug3: key_read: missing keytype
debug1: identity file /Users/user/.ssh/root_gitlab.mydomain.com.de type 1
debug1: identity file /Users/user/.ssh/root_gitlab.mydomain.com-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.0p1 Debian-4
debug1: match: OpenSSH_6.0p1 Debian-4 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.6
debug2: fd 3 setting O_NONBLOCK
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-dss-cert-v00@openssh.com,ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: first_kex_follows 0 
debug2: kex_parse_kexinit: reserved 0 
debug2: kex_parse_kexinit: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-sha2-256,hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-sha2-256,hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: first_kex_follows 0 
debug2: kex_parse_kexinit: reserved 0 
debug2: mac_setup: found hmac-md5
debug1: kex: server->client aes128-ctr hmac-md5 none
debug2: mac_setup: found hmac-md5
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug2: dh_gen_key: priv key bits set: 119/256
debug2: bits set: 499/1024
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug3: check_host_in_hostfile: host gitlab.mydomain.com filename /Users/user/.ssh/known_hosts
debug3: check_host_in_hostfile: host gitlab.mydomain.com filename /Users/user/.ssh/known_hosts
debug3: check_host_in_hostfile: match line 43
debug3: check_host_in_hostfile: host x.x.x.x filename /Users/user/.ssh/known_hosts
debug3: check_host_in_hostfile: host x.x.x.x filename /Users/user/.ssh/known_hosts
debug3: check_host_in_hostfile: match line 38
debug1: Host 'gitlab.mydomain.com' is known and matches the RSA host key.
debug1: Found key in /Users/user/.ssh/known_hosts:43
debug2: bits set: 511/1024
debug1: ssh_rsa_verify: signature correct
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /Users/user/.ssh/id_rsa (0x105725350)
debug2: key: /Users/user/.ssh/root_gitlab.mydomain.com (0x105724510)
debug1: Authentications that can continue: publickey,password
debug3: start over, passed a different list publickey,password
debug3: preferred gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/user/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,password
debug1: Offering RSA public key: /Users/user/.ssh/root_gitlab.mydomain.com
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,password
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
root@gitlab.mydomain.com's password:

问题是什么?

更新2:

这个 [SSH Key asks for password] 不起作用

更新3:

> sudo git clone --verbose git@gitlab.mydomain.com:ws.git
Cloning into 'ws'...
fatal: The remote end hung up unexpectedly

最佳答案

从这里找到解决方案gitlabhq issue on github :

查看您的 puma 或 unicorn 服务器配置:

sudo nano /home/git/gitlab/config/puma.rb

在那里读到一个绑定(bind)的 url(有趣的是端口 - 在我的例子中它是 9292//我将绑定(bind)变体从 unix 管道更改为 http://0.0.0.0:9292 一段时间前)

适当修改gitlab-shell中的config.yml:

sudo nano /home/git/gitlab-shell/config.yml

重启gitlab服务:

sudo service gitlab restart

(我不知道,但我也重新启动了 apache:sudo service apache2 restart)

完成:

现在,只需从项目页面复制 url 并执行:

git clone your-gitlab-url

关于git - 从 gitlab 克隆 repo 的问题(致命的 : The remote end hung up unexpectedly),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17962590/

相关文章:

远程分支的暂存或未暂存更改之间的 Git diff

ruby - 没有注释的 Git diff

php - 使用 .htaccess 将不带扩展名的热链接重定向到父网站

spring - 如何在 apache 中添加虚拟主机以指向部署在 Tomcat 上的 spring REST API

Git克隆SSH - 致命的协议(protocol)错误

git - 将工作保存到多个提交中

git - 相当于 "svn checkout"的 git?

apache - 安全性:使用 htaccess 和 HTTP_USER_AGENT 阻止不良蜘蛛和机器人访问网站

shell - 需要查看24小时内哪些文件已更改并发送电子邮件(Shell脚本)

ssh - SOCKS代理转发