3

我放在 Gitlab GUI 中的密钥没有显示在 authorized_keys 文件中。因此我不能推或拉 ssh。任何尝试都要求我输入 ssh 密码 :-(

我正在使用 gitlab 6.2 稳定版。这是一些命令的输出

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 和其他地方看到过类似的线程,但没有一个对我有用。

4

1 回答 1

5

GitLab调用gitlab-shell以添加密钥时,问题就出现了;听起来引号字符正在以#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-keys某种方式潜入调用。key.shell_id里面不能有引号,因为它是作为 "key-#{id}" 生成的,并且key.key验证为可识别的 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,罪魁祸首,则该值源自 中gitlab-shell: ssh_user:设置gitlab.yml,如果不存在则默认为。 gitlab: user如果您设置了其中任何一个,请仔细检查您的 YAML 语法!

于 2013-10-29T14:51:59.957 回答