V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
geew
V2EX  ›  问与答

gitlab 权限问题

  •  
  •   geew · 2014-06-11 15:42:04 +08:00 · 10733 次点击
    这是一个创建于 3813 天前的主题,其中的信息可能已经有所发展或是发生改变。
    尼玛 好不容易配好了 以为能正常工作, 然后用root新建了个用户, 然后也加了ssh-public key了, 但是克隆的时候还是报权限错误, 求解, 有人遇到过这个问题吗? 第一次配这玩意, 大家帮帮忙咯.

    git clone [email protected]: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)
    第 1 条附言  ·  2014-06-17 10:12:42 +08:00
    附上最后的解决方案吧:
    其实整体的配置是没问题的, 主要是gitlab-shell的权限验证那块的问题, 先去gitlab-shell目录里面看日志就可以看到该错误(日志文件gitlab-shell.log), 然后配置一下, config.yml, 类似这样子的:
    ---
    user: git
    gitlab_url: http://gitlab.oa.com/ # 这个url注意, 配置成你的服务url, 如果是本地,还需要配置/etc/hosts 添加一条 例如: 192.168.1.23 gitlab.oa.com
    http_settings:
    self_signed_cert: false
    repos_path: /home/git/repositories/
    auth_file: /home/git/.ssh/authorized_keys
    redis:
    bin: /usr/bin/redis-cli
    host: localhost
    port: 6379
    namespace: resque:gitlab
    log_level: INFO
    audit_usernames: false

    我就是那个url的配置问题
    11 条回复    2014-06-17 11:24:42 +08:00
    geew
        1
    geew  
    OP
       2014-06-11 16:04:29 +08:00
    顶上去 来人啊
    orzfly
        2
    orzfly  
       2014-06-11 16:17:24 +08:00
    gitlab.oa.com 里看看 /home/git/.ssh/authorized_keys 有没有出现你的 public key,如果没有说明 gitlab 的 sidekiq 又挂了……
    geew
        3
    geew  
    OP
       2014-06-11 16:28:31 +08:00
    @orzfly 有的
    而且执行
    ssh -T [email protected]
    Welcome to GitLab, Anonymous!

    这个提示也是对的吧
    orzfly
        4
    orzfly  
       2014-06-11 16:32:57 +08:00
    @geew 错了错了,出现 Anonymous 就说明错了……
    geew
        5
    geew  
    OP
       2014-06-11 16:36:48 +08:00
    @orzfly 那该出现什么? 我让同事试了这个命令, 他是提示输入密码
    geew
        6
    geew  
    OP
       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: [email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected],[email protected],[email protected],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,[email protected]
    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,[email protected]
    debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-sha2-256,hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
    debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-sha2-256,hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
    debug2: kex_parse_kexinit: none,[email protected],zlib
    debug2: kex_parse_kexinit: none,[email protected],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: [email protected],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,[email protected],[email protected],[email protected],aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]
    debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,[email protected],[email protected],[email protected],aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]
    debug2: kex_parse_kexinit: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-md5,hmac-sha1,[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
    debug2: kex_parse_kexinit: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-md5,hmac-sha1,[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
    debug2: kex_parse_kexinit: none,[email protected]
    debug2: kex_parse_kexinit: none,[email protected]
    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 [email protected]
    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 [email protected] 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
        7
    orzfly  
       2014-06-11 17:36:07 +08:00 via Android
    应该是 Welcome 后面有你的名字,而不是匿名。

    你看看 gitlab (和 gitlab-shell)的日志 我记得有个 /api/xxxxx/internal/xxxxxxx 的请求会用来鉴权。这个请求如果失败就会匿名。
    geew
        8
    geew  
    OP
       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
        9
    orzfly  
       2014-06-11 18:31:28 +08:00   ❤️ 1
    我这边通过 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
        10
    geew  
    OP
       2014-06-12 09:54:40 +08:00
    @orzfly 感谢 谁晓得最后是url配置的问题呢...
    chjwdzhr
        11
    chjwdzhr  
       2014-06-17 11:24:42 +08:00
    @geew 你好,我也遇到同样的问题了,能给说一下具体是哪的url配置的问题么
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1104 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 22:43 · PVG 06:43 · LAX 14:43 · JFK 17:43
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.