我正在运行去年秋天安装的 GitLab 版本。不幸的是,我无法确定版本号。它托管在 Win10 主机上的 VM 中的 Ubuntu 1404 上。更新:看起来是版本 9.4.3-ce.0,是 Ubuntu 软件包服务器提供的最新版本。
我正在从一场灾难中恢复,这场灾难需要我冷重装 Win10。我在 VirtualBox 中启动并运行了虚拟机。我的 GitLab 登录凭据似乎工作正常 - 我可以登录服务器,并且可以使用 http 克隆我的项目。我无法通过 ssh 访问服务器。我应该补充一点,在灾难发生之前一切都运行正常。
从 msys bash 我可以顺利通过 ssh 进入虚拟机,但所有通过 ssh 访问 GitLab 的尝试都会引发以下情况:
$ git push origin dev-5-1-0
fatal: 'git@elm-ub1404/xxx/program.git' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我已经验证过 GitLab 的 Settings/ssh-keys 中的密钥是正确的。我甚至删除了它然后又添加回来,但无济于事。
日志文件 gitlab-shell.log 包含以下内容:
W, [2017-08-07T22:58:00.754776 #23099] WARN -- : gitlab-shell: Attempt to execute disallowed command <git receive-pack 'user/program.git'> by user with key key-1.
W, [2017-08-07T23:03:07.060909 #23937] WARN -- : gitlab-shell: Attempt to execute disallowed command <git receive-pack 'user/program.git'> by user with key key-1.
W, [2017-08-07T23:05:51.418158 #24333] WARN -- : gitlab-shell: Attempt to execute disallowed command <git receive-pack 'user/pruProgram.git'> by user with key key-1.
W, [2017-08-07T23:08:33.799837 #24841] WARN -- : gitlab-shell: Attempt to execute disallowed command <git receive-pack 'user/pruProgram.git'> by user with key key-1.
W, [2017-08-07T23:09:22.509888 #25006] WARN -- : gitlab-shell: Attempt to execute disallowed command <git receive-pack 'user/pruProgram.git'> by user with key key-1.
W, [2017-08-07T23:13:57.921136 #25626] WARN -- : gitlab-shell: Attempt to execute disallowed command <git receive-pack 'user/pruProgram.git'> by user with key key-1.
W, [2017-08-07T23:19:01.909144 #26864] WARN -- : gitlab-shell: Attempt to execute disallowed command <git upload-pack 'user/pruProgram.git'> by user with key key-1.
W, [2017-08-07T23:22:22.732120 #27344] WARN -- : gitlab-shell: Attempt to execute disallowed command <git upload-pack 'user/pruProgram.git'> by user with key key-1.
I, [2017-08-07T23:44:11.110398 #30251] INFO -- : Adding key key-2 => "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDITEDPYSbseUrbFW3Ii5dcKi6g4BJXi0U3yiK81NwXGcXGHMJCjlHNhblssetztc3xLuugK7syG+Sapt3kDvGzcOTi3NFrpYpv5y7RPlNVMBsgC+hSdsX3u6TZMuoSAByfgNK+DEkSGkgelrp6XIUWR4C4urLcxDqK7TFMM3xYF0JiE7t3lLRR7T8o+UY8gXozrmHyZout1CHpNv3OY9JDdj7V6+KjKAuVplJaqsx9zAh5sF7aGCUHUM5DESriLUjqgEgc+tZ4s31PPdgnhkX0Scm8M2405vnwLqIJ2a3qmpAwvOcM/rC/LTOJg4k7tjDtCEOr7v5usBNZwsUeiuuD"
W, [2017-08-07T23:48:40.016559 #30875] WARN -- : gitlab-shell: Attempt to execute disallowed command <git upload-pack 'user/pru6c.git'> by user with key key-1.
W, [2017-08-08T09:02:52.468088 #3630] WARN -- : gitlab-shell: Attempt to execute disallowed command <git upload-pack 'user/pru6c.git'> by user with key key-1.
I, [2017-08-08T09:04:31.179381 #3828] INFO -- : Removing key key-2
I, [2017-08-08T09:04:36.470186 #3852] INFO -- : Removing key key-1
I, [2017-08-08T09:05:17.803599 #3942] INFO -- : Adding key key-3 => "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDRFtPPqEGtCrgUHD+Q/WJcNKxOGm3h+paLQM9TOoDBQLG4HBb9cHoMPLEcX2USNy2TYaOIRQ8eCNu1O+E2u5RZWjG3rC35ygq5qu7LZH6Eed6vOGp5runWtyGsua3AQlJvu0FK247QeQaKnAmF77CqISW2ul0VDOp+Jw7KtfEf6r0smkkNEG7OpK5Cgjx7MZMNEN1Qsp8AzphcbLOTFNLR4oy+yMDUdtG9WDZEZKJmhpt0VeG1WAVHpxanLwza3fNG/Kwb2s6NolDD6CQAWaqM63wYh3HbU2m/S6kcLaAs1WDE0VIiVfIjoEMhnYVrcMKS6qAWYbjgJ7N5Dvq3JCXr"
由于某种原因,在删除并替换原始密钥(删除密钥 1 并将其重新输入为密钥 3)后,我尝试访问 repo,但 gitlab-shell.log 中不再出现日志消息。
当我执行“ssh -Tv git@elm-ub1404”时,我得到以下信息:
OpenSSH_7.5p1, OpenSSL 1.0.2k 26 Jan 2017
debug1: Reading configuration data /home/user/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to elm-ub1404 [192.168.55.230] port 22.
debug1: Connection established.
debug1: identity file /home/user/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.5
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8 pat OpenSSH_6.6.1* compat 0x04000000
debug1: Authenticating to elm-ub1404:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: [email protected]
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:p7T0NBYGy8Jwuv1OH3bIvuykgiqypAxfUXoVtqQoh8Q
debug1: Host 'elm-ub1404' is known and matches the ECDSA host key.
debug1: Found key in /home/user/.ssh/known_hosts:23
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/user/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Authentication succeeded (publickey).
Authenticated to elm-ub1404 ([192.168.55.230]:22).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: pledge: exec
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.
debug1: No xauth program.
Warning: No xauth data; using fake authentication data for X11 forwarding.
debug1: Requesting X11 forwarding with authentication spoofing.
debug1: Remote: X11 forwarding disabled in user configuration file.
X11 forwarding request failed on channel 0
Welcome to GitLab, Bob Duffy!
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 2800, received 3080 bytes, in 2.3 seconds
Bytes per second: sent 1219.8, received 1341.7
debug1: Exit status 0
我的问题是:
- 如何获取有关 git-ssh 连接的更多信息?
- 如何重新获得 GitLab 的 ssh 访问权限?
更新:
为了确保万无一失,我从 GitLab 项目页面复制了 repo 引用:
Elm-10:~/gitlabTest$ git clone git@elm-ub1404:rlduffy/program.git
Cloning into 'program'...
Warning: No xauth data; using fake authentication data for X11 forwarding.
X11 forwarding request failed on channel 0
GitLab: Disallowed command
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Elm-10:~/gitlabTest$ git clone http://elm-ub1404/rlduffy/program.git
Cloning into 'program'...
remote: Counting objects: 4760, done.
remote: Compressing objects: 100% (24/24), done.
remote: Total 4760 (delta 8), reused 0 (delta 0)
Receiving objects: 100% (4760/4760), 3.09 MiB | 19.54 MiB/s, done.
Resolving deltas: 100% (3542/3542), done.
答案1
我怀疑问题会通过卸载并重新安装 GitLab 自行解决,但我现在还没准备好这样做,所以我只能改用 http。