gitlab 权限问题

2014-06-11 15:42:04 +08:00
 geew
尼玛 好不容易配好了 以为能正常工作, 然后用root新建了个用户, 然后也加了ssh-public key了, 但是克隆的时候还是报权限错误, 求解, 有人遇到过这个问题吗? 第一次配这玩意, 大家帮帮忙咯.

git clone git@gitlab.oa.com:geew/test.git
Cloning into 'test'...
Access denied.
fatal: The remote end hung up unexpectedly

- 私钥已经加到ssh里面了的
geew@geew:~/test$ ssh-add -l
2048 cf:8c:28:26:82:a7:18:44:e4:ee:d8:db:a0:cd:0e:12 id_rsa (RSA)
10656 次点击
所在节点    问与答
11 条回复
geew
2014-06-11 16:04:29 +08:00
顶上去 来人啊
orzfly
2014-06-11 16:17:24 +08:00
gitlab.oa.com 里看看 /home/git/.ssh/authorized_keys 有没有出现你的 public key,如果没有说明 gitlab 的 sidekiq 又挂了……
geew
2014-06-11 16:28:31 +08:00
@orzfly 有的
而且执行
ssh -T git@gitlab.oa.com
Welcome to GitLab, Anonymous!

这个提示也是对的吧
orzfly
2014-06-11 16:32:57 +08:00
@geew 错了错了,出现 Anonymous 就说明错了……
geew
2014-06-11 16:36:48 +08:00
@orzfly 那该出现什么? 我让同事试了这个命令, 他是提示输入密码
geew
2014-06-11 16:55:17 +08:00
@orzfly ssh 的调试信息, 感觉不是ssh的问题

OpenSSH_5.9p1 Debian-5ubuntu1.4, OpenSSL 1.0.1 14 Mar 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to gitlab.oa.com [192.168.58.220] port 22.
debug1: Connection established.
debug1: identity file /home/geew/.ssh/id_rsa type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /home/geew/.ssh/id_rsa-cert type -1
debug1: identity file /home/geew/.ssh/id_dsa type -1
debug1: identity file /home/geew/.ssh/id_dsa-cert type -1
debug1: identity file /home/geew/.ssh/id_ecdsa type -1
debug1: identity file /home/geew/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1.4
debug2: fd 3 setting O_NONBLOCK
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
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: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,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-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,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: curve25519-sha256@libssh.org,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,ssh-ed25519
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,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-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,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: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA 0b:7d:a7:02:8c:c1:74:a2:f6:0b:9f:9a:e1:76:0a:08
debug1: Host 'gitlab.oa.com' is known and matches the ECDSA host key.
debug1: Found key in /home/geew/.ssh/known_hosts:1
debug1: ssh_ecdsa_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: /home/geew/.ssh/id_rsa (0x7fcb38067680)
debug2: key: /home/geew/.ssh/id_dsa ((nil))
debug2: key: /home/geew/.ssh/id_ecdsa ((nil))
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/geew/.ssh/id_rsa
debug2: we sent a publickey packet, wait for reply
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug2: input_userauth_pk_ok: fp cf:8c:28:26:82:a7:18:44:e4:ee:d8:db:a0:cd:0e:12
debug1: Authentication succeeded (publickey).
Authenticated to gitlab.oa.com ([192.168.58.220]:22).
debug1: channel 0: new [client-session]
debug2: channel 0: send open
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Remote: Forced command.
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Remote: Forced command.
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug2: callback start
debug2: client_session2_setup: id 0
debug2: fd 3 setting TCP_NODELAY
debug2: channel 0: request pty-req confirm 1
debug1: Sending environment.
debug1: Sending env LC_PAPER = zh_CN.UTF-8
debug2: channel 0: request env confirm 0
debug1: Sending env LC_ADDRESS = zh_CN.UTF-8
debug2: channel 0: request env confirm 0
debug1: Sending env LC_MONETARY = zh_CN.UTF-8
debug2: channel 0: request env confirm 0
debug1: Sending env LC_NUMERIC = zh_CN.UTF-8
debug2: channel 0: request env confirm 0
debug1: Sending env LC_TELEPHONE = zh_CN.UTF-8
debug2: channel 0: request env confirm 0
debug1: Sending env LC_IDENTIFICATION = zh_CN.UTF-8
debug2: channel 0: request env confirm 0
debug1: Sending env LANG = zh_CN.UTF-8
debug2: channel 0: request env confirm 0
debug1: Sending env LC_MEASUREMENT = zh_CN.UTF-8
debug2: channel 0: request env confirm 0
debug1: Sending env LC_TIME = zh_CN.UTF-8
debug2: channel 0: request env confirm 0
debug1: Sending env LC_NAME = zh_CN.UTF-8
debug2: channel 0: request env confirm 0
debug2: channel 0: request shell confirm 1
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel_input_status_confirm: type 100 id 0
PTY allocation request failed on channel 0
debug2: channel 0: rcvd adjust 2097152
debug2: channel_input_status_confirm: type 99 id 0
debug2: shell request accepted on channel 0
Welcome to GitLab, Anonymous!
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0
debug2: channel 0: rcvd eow
debug2: channel 0: close_read
debug2: channel 0: input open -> closed
debug2: channel 0: rcvd eof
debug2: channel 0: output open -> drain
debug2: channel 0: obuf empty
debug2: channel 0: close_write
debug2: channel 0: output drain -> closed
debug2: channel 0: rcvd close
debug2: channel 0: almost dead
debug2: channel 0: gc: notify user
debug2: channel 0: gc: user detached
debug2: channel 0: send close
debug2: channel 0: is dead
debug2: channel 0: garbage collecting
debug1: channel 0: free: client-session, nchannels 1
Connection to gitlab.oa.com closed.
Transferred: sent 3528, received 3112 bytes, in 0.4 seconds
Bytes per second: sent 8723.7, received 7695.0
debug1: Exit status 0
orzfly
2014-06-11 17:36:07 +08:00
应该是 Welcome 后面有你的名字,而不是匿名。

你看看 gitlab (和 gitlab-shell)的日志 我记得有个 /api/xxxxx/internal/xxxxxxx 的请求会用来鉴权。这个请求如果失败就会匿名。
geew
2014-06-11 17:49:31 +08:00
@orzfly 是这个吗
./production.log:Started PUT "/api/v3/authorizations/clients/eac522c6b68c504b2aac" for 127.0.0.1 at 2014-06-11 16:28:21 +0800
./production.log:ActionController::RoutingError (No route matches [PUT] "/api/v3/authorizations/clients/eac522c6b68c504b2aac"):
./production.log:Started PUT "/api/v3/authorizations/clients/eac522c6b68c504b2aac" for 127.0.0.1 at 2014-06-11 16:28:22 +0800
./production.log:ActionController::RoutingError (No route matches [PUT] "/api/v3/authorizations/clients/eac522c6b68c504b2aac"):
./production.log:Started PUT "/api/v3/authorizations/clients/eac522c6b68c504b2aac" for 127.0.0.1 at 2014-06-11 16:29:56 +0800
./production.log:ActionController::RoutingError (No route matches [PUT] "/api/v3/authorizations/clients/eac522c6b68c504b2aac"):
./production.log:Started PUT "/api/v3/authorizations/clients/eac522c6b68c504b2aac" for 127.0.0.1 at 2014-06-11 16:29:56 +0800
./production.log:ActionController::RoutingError (No route matches [PUT] "/api/v3/authorizations/clients/eac522c6b68c504b2aac"):
orzfly
2014-06-11 18:31:28 +08:00
我这边通过 SSH 登陆的时候,production.log 里会出现一条:
Started GET "//api/v3/internal/discover?key_id=16" for 127.0.0.1 at 2014-06-11 18:30:37 +0800
geew
2014-06-12 09:54:40 +08:00
@orzfly 感谢 谁晓得最后是url配置的问题呢...
chjwdzhr
2014-06-17 11:24:42 +08:00
@geew 你好,我也遇到同样的问题了,能给说一下具体是哪的url配置的问题么

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/116916

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX