GitLab SSH密钥停止工作

GitLab SSH密钥停止工作,git,github,ssh,private-key,gitlab,Git,Github,Ssh,Private Key,Gitlab,好吧,我已经多次偶然发现这个话题,但这是第一次常规解决方案都不起作用 我有一台CentOS 6.4服务器正在运行。它在20多个用户和60多个项目中工作得很好,但大约5小时前,我的主暂存服务器第一次无法使用密钥身份验证连接到GitLab机器,并提示输入密码。我重新生成了RSA密钥并将其添加到部署密钥中,但也失败了 接下来,我尝试在临时服务器上创建一个新用户,为其创建一个密钥,并将其添加到GitLab,但仍然失败 权限: drwxr-x--- 22 root root 4.0K Oct 28 13

好吧,我已经多次偶然发现这个话题,但这是第一次常规解决方案都不起作用

我有一台CentOS 6.4服务器正在运行。它在20多个用户和60多个项目中工作得很好,但大约5小时前,我的主暂存服务器第一次无法使用密钥身份验证连接到GitLab机器,并提示输入密码。我重新生成了RSA密钥并将其添加到部署密钥中,但也失败了

接下来,我尝试在临时服务器上创建一个新用户,为其创建一个密钥,并将其添加到GitLab,但仍然失败

权限:

drwxr-x---  22 root root 4.0K Oct 28 13:20 root
内部根:

drwx------   2 root root     4096 Oct 28 11:49 .ssh
Inside.ssh:

-rw-------  1 root root  227 Oct 28 11:48 authorized_keys
-rw-------  1 root root 1675 Oct 28 13:09 id_rsa
-rw-------  1 root root  398 Oct 28 13:09 id_rsa.pub
-rw-r--r--  1 root root  413 Oct 28 11:49 known_hosts
当我尝试连接到git机器时:

OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to git.mygitlab.com [212.29.122.24] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/identity type -1
debug1: identity file /root/.ssh/id_rsa type 1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: loaded 3 keys
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.3
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'git.mygitlab.com' is known and matches the RSA host key.
debug1: Found key in /root/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
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,gssapi-keyex,gssapi-with-    mic,password
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure.  Minor code may provide more information
No credentials cache found

debug1: Unspecified GSS failure.  Minor code may provide more information
No credentials cache found

debug1: Unspecified GSS failure.  Minor code may provide more information
No credentials cache found

debug1: Next authentication method: publickey
debug1: Offering public key: /root/.ssh/id_rsa
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-    mic,password
debug1: Trying private key: /root/.ssh/identity
debug1: Trying private key: /root/.ssh/id_dsa
debug1: Next authentication method: password
git@git.mygitlab.com's password:
OpenSSH_4.3p2,OpenSSL 0.9.8e-fips-rhel5 2008年7月1日
debug1:读取配置数据/etc/ssh/ssh\u config
debug1:将选项应用于*
debug1:连接到git.mygitlab.com[212.29.122.24]端口22。
debug1:已建立连接。
debug1:永久\u设置\u uid:0/0
debug1:identity file/root/.ssh/identity-type-1
debug1:标识文件/root/.ssh/id\u rsa类型1
debug1:标识文件/root/.ssh/id_dsa类型-1
debug1:加载了3个键
debug1:远程协议版本2.0,远程软件版本OpenSSH_5.3
debug1:match:OpenSSH_5.3 pat OpenSSH*
debug1:启用协议2.0的兼容模式
debug1:本地版本字符串SSH-2.0-OpenSSH_4.3
debug1:SSH2\u MSG\u KEXINIT已发送
debug1:SSH2\u MSG\u KEXINIT已收到
debug1:kex:server->client aes128 cbc hmac-md5无
debug1:kex:client->server aes128 cbc hmac-md5无

debug1:SSH2\u MSG\u KEX\u DH\u GEX\u请求(1024如果添加到GitLab的密钥没有进入
。ssh/authorized\u keys

  • 确保sidekiq正在运行。密钥被添加到sidekiq worker中的gitlab外壳中,因此如果sidekiq关闭或积压,它们将无法进入。您可以在
    ps-fu git
    的输出中检查这一点,并通过检查管理页面上的“后台作业”选项卡进行检查
  • 确保GitLab可以正确执行GitLab shell。Sidekiq工作人员通过添加密钥。特别是,如果中的
    ssh_user
    设置不正确,或者GitLab shell安装到该用户的
    ~/GitLab shell
    以外的位置,这将不起作用
  • 验证服务器的/home分区是否已满。如果存储
    authorized\u keys
    文件的磁盘已满,则key追加为fail!此项已让我使用了几次。使用
    df-h/home
    查看您是否还有空间
  • 检查您的日志中是否有来自gitlab shell的错误消息:根据问题的不同,错误消息可能会出现在unicorn或sidekiq的日志中。

    好吧,现在我在5.1以下 我一步一步地做 4.1 > 4.2 4.2 > 4.3 最后一切都开始运转了

    只是为了让4.1用户知道->其中一个开发人员添加了一个坏键,包括$#root。。。 这就是打破同步的原因


    谢谢你的帮助

    当我将GitLab服务器从HTTP切换到HTTPS时,我遇到了这个问题。web服务器上的一切看起来都很好-登录等都正常,但是git@gitlabSSH连接失败


    在查看#2英寸(上图)后我发现我需要修改
    /home/git/gitlab shell/config.yaml中的
    gitlab\u url
    设置以使用
    https://gitlab.server.fqdn
    而不是
    http://gitlab.server.fqdn
    。我更改了设置,重新启动了gitlab服务,一切正常。

    必须删除所有以前的ke问题是gitlab会使用任何旧密钥,如果不存在匹配项,则会失败。您的工作密钥可能会稍后按顺序列出,并且不会被拾取。

    您是否在
    git.mygitlab.com:~git/.ssh/authorized_keys
    中看到您的公钥?事实上,没有!我在访问gitlab服务器时,在authorized keys文件中有49个密钥添加额外的密钥,它们不会出现,所以这就是问题所在。gitlab中是否有任何日志会留下线索?我找不到,我可以将ssh密钥添加到gitlab web gui,但它们不会添加到授权密钥,因此简单的重启不会有帮助?(如中所示)嗨,Ash,你是100%正确的,但正如我说的,我使用的是Gitlab的旧版本(4.1)而且我没有gitlab shell..我正试图一个版本一个版本地升级,直到版本更新哦,对了,我错过了那一点。是的,4.1回到了Gitlite时代。如果你直接拉Gitlite配置repo,你的密钥会进入Gitlite的设置吗?如果不是,就有一个Rake任务来重新同步一切:
    Rake gitlab:gitolite:update_keys
    您的gitolite安装也可能有问题,例如缺少或无法执行post receive挂钩。请仔细检查您的gitolite安装:很有意思。+1