Gitlab 6.2 不与授权 key 同步

标签 gitlab

我在 Gitlab GUI 中放入的 key 没有显示在authorized_keys 文件中。因此我无法推送或拉过 ssh。任何尝试都会要求我输入 ssh 密码:-(

我使用的是 gitlab 6.2 stable。以下是一些命令的输出

git@CVIAL272675:~/gitlab$ bundle exec rake gitlab:shell:setup RAILS_ENV=production
This will rebuild an authorized_keys file.
You will lose any data stored in authorized_keys file.
Do you want to continue (yes/no)? yes

sh: 1: Syntax error: Unterminated quoted string
Fgit@CVIAL272675:~/gitlab$

git@CVIAL272675:~/gitlab$ bundle exec rake gitlab:check RAILS_ENV=production
Checking Environment ...

Git configured for git user? ... yes
Has python2? ... yes
python2 is supported version? ... yes

Checking Environment ... Finished

Checking GitLab Shell ...

GitLab Shell version >= 1.7.1 ? ... OK (1.7.1)
Repo base directory exists? ... yes
Repo base directory is a symlink? ... no
Repo base owned by git:git? ... yes
Repo base access is drwxrws---? ... yes
update hook up-to-date? ... yes
update hooks in repos are links: ...
Snehadeep Sethia / CodeRush ... ok
Bharath Bhushan Lohray / PyPGPWord ... ok
Running /home/git/gitlab-shell/bin/check
Check GitLab API access: OK
Check directories and files:
        /home/git/repositories: OK
        /home/git/.ssh/authorized_keys: OK
gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Sidekiq ...

Running? ... yes
Number of Sidekiq processes ... 1

Checking Sidekiq ... Finished

Checking GitLab ...

Database config exists? ... yes
Database is SQLite ... no
All migrations up? ... yes
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Init script exists? ... yes
Init script up-to-date? ... yes
projects have namespace: ...
Snehadeep Sethia / CodeRush ... yes
Bharath Bhushan Lohray / PyPGPWord ... yes
Projects have satellites? ...
Snehadeep Sethia / CodeRush ... yes
Bharath Bhushan Lohray / PyPGPWord ... yes
Redis version >= 2.0.0? ... yes
Your git bin path is "/usr/bin/git"
Git version >= 1.7.10 ? ... yes (1.8.3)

Checking GitLab ... Finished

git@CVIAL272675:~/gitlab$

sidekiq.log

2013-10-29T04:08:37Z 18931 TID-os8rme7b4 INFO: Booting Sidekiq 2.14.0 using redis://localhost:6379 with options {:namespace=>"resque:gitlab"}
2013-10-29T04:08:37Z 18931 TID-os8rme7b4 INFO: Running in ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux]
2013-10-29T04:08:37Z 18931 TID-os8rme7b4 INFO: See LICENSE and the LGPL-3.0 for licensing details.
2013-10-29T04:10:55Z 18931 TID-os8s00k6g Sidekiq::Extensions::DelayedMailer JID-10b66a2f8897dd56487c57cd INFO: start
2013-10-29T04:10:56Z 18931 TID-os8s00k6g Sidekiq::Extensions::DelayedMailer JID-10b66a2f8897dd56487c57cd INFO: done: 0.472 sec
2013-10-29T04:11:55Z 18931 TID-os8s00k6g Sidekiq::Extensions::DelayedMailer JID-a63f9cad0c98b605c76e0613 INFO: start
2013-10-29T04:11:55Z 18931 TID-os8s00k6g Sidekiq::Extensions::DelayedMailer JID-a63f9cad0c98b605c76e0613 INFO: done: 0.263 sec
2013-10-29T04:14:36Z 18931 TID-os8s00k6g GitlabShellWorker JID-af69358238a2b2cc4c5884c2 INFO: start
sh: 1: Syntax error: Unterminated quoted string
2013-10-29T04:14:37Z 18931 TID-os8s00k6g GitlabShellWorker JID-af69358238a2b2cc4c5884c2 INFO: done: 0.757 sec
2013-10-29T04:14:40Z 18931 TID-os8s00k6g Sidekiq::Extensions::DelayedMailer JID-4020b22e54a09bc63401f08b INFO: start
2013-10-29T04:14:41Z 18931 TID-os8s00k6g Sidekiq::Extensions::DelayedMailer JID-4020b22e54a09bc63401f08b INFO: done: 0.29 sec

我还能做什么?我该如何解决?我在 stackoverflow 和其他地方看到过类似的帖子,但没有一个对我有用。

最佳答案

问题发生在 GitLab shells out 时调用 gitlab-shell 来添加 key ;听起来好像引号字符正在潜入对 #{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-keys 的调用中。 key.shell_id 中不能有引号,因为它是 generated as "key-#{id}"key.keyvalidated as an recognizable ssh-rsa key ,所以在我看来,#{gitlab_shell_user_home} 很可能有一个无关的字符。

要验证,如果可能的话,您可以在前面添加一个 puts "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-keys add-key #{key_id} #{key_content}系统调用(并重新启动 sidekiq)以查看 GitLab 将要尝试的实际 shell 命令。这应该可以让您追踪额外引用的来源。

如果 gitlab_shell_user_home罪魁祸首,则该值为 derived from gitlab.yml 中的 gitlab-shell: ssh_user: 设置,其中 defaults to gitlab: user(如果不存在)。如果您设置了其中任何一个,请仔细检查您的 YAML 语法!

关于Gitlab 6.2 不与授权 key 同步,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19646780/

相关文章:

xcode - 无法使用 https 将 Git 存储库添加到 Xcode 7

gitlab - 图标被矩形替换

gitlab - git-flow 与 github-flow 的优缺点是什么?

docker - 如何在 gitlab-ci-runner-docker 中使用 docker 和 npm

git - Azure 部署因 gitlab 失败

git - 为什么我不能删除远程 GitLab 存储库中的分支?

docker - GitLab runner docker executor 通过 IP 地址回调 gitlab 服务器

java - 如何在您的网站上实现 Git/GitLab 以使人们能够编写代码?

GitLab CI - 仅在计划的管道上自动运行任务

git - SSH 的指纹与 Gitlab.com 不匹配