GitLab v5.0 git推问题

sad*_*ave 5 git ssh-keys gitlab ubuntu-12.04

我正在创建这个问题,以帮助其他人在尝试推送初始化的repo时搜索有关两个GitLab配置问题的文档:

1:即使在GitLab前端设置SSH密钥后,GitLab服务器上的git用户也需要密码:

$ git push -u origin master
git@hostname's password: 
Run Code Online (Sandbox Code Playgroud)

2:gitlab-shell客户端在尝试推送时似乎在你的repo的错误位置(/home/git/repositories所有存储库应按照指定的方式存储/home/git/gitlab-shell/config.yml):

$ git push -v -u origin master
Pushing to git@hostname:sadmicrowave/test-project.git
fatal: 'sadmicrowave/test-project.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
Run Code Online (Sandbox Code Playgroud)

sad*_*ave 6

当在GitLab前端添加SSH密钥时,我注意到它没有相应地添加到/home/git/.ssh/authorized_keys文件中.经过一番挖掘后,我发现这个https://github.com/gitlabhq/gitlabhq/issues/3120指出要运行以下rake:

rake gitlab:shell:setup RAILS_ENV=production
Run Code Online (Sandbox Code Playgroud)

注意:引用会遗漏该部分,RAILS_EVN=production但这是必需的,因此您不会收到另一个错误说明cannot load such file -- rb-inotify

由于我的git用户没有sudo访问权限,我必须使用sudo从另一个用户登录运行上述命令,然后运行以下命令将适当的权限(git)返回到.ssh目录:

$ sudo chgrp -R git /home/git/.ssh
$ sudo chown -R git /home/git/.ssh
Run Code Online (Sandbox Code Playgroud)

毕竟,返回GitLab前端,删除并重新创建SSH-Key(您可以使用与以前相同的公钥).

你应该看到正确的记录/home/git/.ssh/authorized_keys,如果你git push -v -u origin master从本地机器运行,你现在应该是好的!