GitLab v5.0 git推问题

时间:2013-04-23 21:18:46

标签: git ubuntu-12.04 ssh-keys gitlab

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

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

$ git push -u origin master
git@hostname's password: 

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

1 个答案:

答案 0 :(得分:6)

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

rake gitlab:shell:setup RAILS_ENV=production

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

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

$ sudo chgrp -R git /home/git/.ssh
$ sudo chown -R git /home/git/.ssh

毕竟,回到GitLab前端,删除并重新创建SSH-Key(您可以像以前一样使用相同的公钥)。

您应该在/home/git/.ssh/authorized_keys中看到正确的记录,如果您从本地计算机上运行git push -v -u origin master,那么您现在应该很好!