为什么与gitlab的ssh连接不起作用(而http push和clone可以正常工作)? [英] Why does ssh connection to gitlab not work (while http push and clone work fine)?
问题描述
我在旧电脑上运行了x86 raring ringtail,并安装了bitnami gitlab 5.3.
I run a x86 raring ringtail on a old pc and having installed bitnami gitlab 5.3.
在尝试以SSH模式推送第一个master分支时,这是我的错误消息:
Here is my error msg when trying to push the first master branch in SSH mode:
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
(它与gitlab Web仪表板凭据一起用于http协议)
(it works in http protocol with the gitlab web dashboard credentials)
- 我已经用
root
用户启动了bitnami-installer.run
,所以我认为所有文件都放在了/opt
中,而不是在/home
中(这是很好的过程吗?) - 在安装GitLab之前,我没有
git
用户,因为我听说它可能会混淆.ssh/authorized_keys
文件和其他权限. - 当我运行
ssh -T git@my-server.com
时,它显示为permission denied (public key)
,但是客户端计算机上的pub键也在.ssh/authorized_keys
中?
对于每行, -
authorized_keys
的内容也正确:
- I have launched
bitnami-installer.run
withroot
user so I think all the files went in/opt
instead of/home
(this was the good procedure?) - I didn't have a
git
user before installing GitLab since I heard it could make a confusion in the.ssh/authorized_keys
files and other permissions. - When I run
ssh -T git@my-server.com
it sayspermission denied (public key)
but the pub key on my client computer is also in.ssh/authorized_keys
? authorized_keys
has the proper content also, with for each line:
command= "/opt/gitlab/apps/"
我还注意到我无法使用sudo -su git nano authorized_keys
显示authorized_keys
文件的内容,因为:
I have also noticed that I cannot display the content of authorized_keys
file with a sudo -su git nano authorized_keys
because:
用户不在sudoers文件中.
the user is not in the sudoers file.
但是sudo /opt/gitlab/apps/gitlab/gitlab-shell/bin/check
会为每个验证(gitlab api,acces,repo和/home/git/.ssh/authorized_keys
文件)返回ok
(因为我已在config.yml gitlab_url中设置为: http://loopbackaddress.com/gitlab ),我注意到我有gitlab-shell目录的两个版本",一个在/opt
中,一个在/home
中,而我不知道这是否是合适的举止吗?
But sudo /opt/gitlab/apps/gitlab/gitlab-shell/bin/check
returns ok
for each verification (gitlab api, acces, repo and /home/git/.ssh/authorized_keys
file (because i have set in th config.yml gitlab_url to : http://myserver.com/gitlab (local server ip address) instead of http://loopbackaddress.com/gitlab). I have noticed that i have « two versions » of the gitlab-shell directory, one in /opt
and one in /home
and i don't know if it it is the appropriated demeanor ?
我几乎可以肯定,这是简单的ssh错误配置,或者是在authorized_keys文件中调用command="/opt/...../gitlab-shell"
时出了点问题
I am almost sure it's either a simple ssh misconfiguration or something wrong when invoking the command="/opt/...../gitlab-shell"
in the authorized_keys file
PS:对于我的家庭服务器,使用git和HTTP协议就足够了,但是gitlab仪表板的兴趣在于通过在Web表单中填充ssh密钥并在
PS: using git with HTTP protocole would be enough for my home server but the interest of the gitlab dashboard is to easily add a contributors by filling the ssh key in the web form and using ssh after
推荐答案
尝试从新安装的gitlab通过ssh克隆回购协议时遇到以下错误:
I've got the following error trying to clone repo via ssh from freshly installed gitlab:
致命:无法从远程存储库读取.
fatal: Could not read from remote repository.
请确保您具有正确的访问权限和存储库 存在.
Please make sure you have the correct access rights and the repository exists.
解决方案位于 https://github上. com/gitlabhq/gitlab-public-wiki/wiki/Trouble-Shooting-Guide#ssh
检查ssh日志/var/log/auth.log,如果发现错误:
Check ssh log /var/log/auth.log and if you find error:
User git not allowed because account is locked
然后编辑/etc/shadow
并更改git:!: to git:*:
P.S. 就我而言,在CentOS 6.5上是/var/log/secure和git:!!:
P.S. In my case on CentOS 6.5 it was /var/log/secure and git:!!:
这篇关于为什么与gitlab的ssh连接不起作用(而http push和clone可以正常工作)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!