我已根据https://github.com/gitlabhq/gitlab-recipes/tree/master/install/centos安装了GitLab。
说明书指出添加用户" git"
adduser --system --shell /sbin/nologin --comment 'GitLab' --create-home --home-dir /home/git/ git
一切似乎都有效。然后我在GitLab服务器上添加了一个项目,并提供了推送它的说明:
cd existing_git_repo
git remote add origin git@mysite.com:root/bidjunction.git
git push -u origin master
然后我去了我的客户端推送到git服务器。
[Michael@devserver bidjunction]$ git push -u origin master
The authenticity of host 'mysite.com (123.456.789.01)' can't be established.
RSA key fingerprint is cd:32:3c:5a:4e:33:44:11:df:ee:3s:4b:3a:c2:a4:c2.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'mysite.com,123.456.789.01' (RSA) to the list of known hosts.
Address 123.456.789.01 maps to ve6.phpwebhosting.com, but this does not map back to the address - POSSIBLE BREAK-IN ATTEMPT!
git@mysite.com's password:
我应该设置密码吗?可能没有,指示也没有解决。
阅读System ask password when push project to github,似乎它可能与SSH有关。
GitLab提供了以下添加SSH密钥的说明。我跟着他们,首先将密钥添加到服务器上的普通用户家中。没变。然后尝试登录root,并在git的主页上添加了一个密钥。仍然没有,但我认为客户端已经拥有我的普通用户密钥,因此没有提取新的git密钥。
EDIT。请确认我应该将这些密钥添加到GitLab服务器,而不是我的Linux客户端。
非常感谢任何和所有帮助。
SSH Keys
SSH key allows you to establish a secure connection between your computer and GitLab
Before generating an SSH key, check if your system already has one by running cat ~/.ssh/id_rsa.pub If your see a long string starting with ssh-rsa or ssh-dsa, you can skip the ssh-keygen step.
To generate a new SSH key just open your terminal and use code below. The ssh-keygen command prompts you for a location and filename to store the key pair and for a password. When prompted for the location and filename you can press enter to use the default. It is a best practice to use a password for an SSH key but it is not required and you can skip creating a password by pressing enter. Note that the password you choose here can't be altered or retrieved.
ssh-keygen -t rsa -C "$your_email"
Use the code below to show your public key.
cat ~/.ssh/id_rsa.pub
Copy-paste the key to the 'My SSH Keys' section under the 'SSH' tab in your user profile. Please copy the complete key starting with ssh- and ending with your username and host.
编辑2
看起来我很困惑,并使用了GitLab的服务器id_rsa.pub。猜猜那没有任何意义!我已经纠正了它,但现在我收到了这个错误:
[Michael@devserver ~]$ ssh git@mysite.com
Address 123.456.789.01 maps to ve6.phpwebhosting.com, but this does not map back to the address - POSSIBLE BREAK-IN ATTEMPT!
PTY allocation request failed on channel 0
This account is currently not available.
Connection to mysite.com closed.
[Michael@devserver ~]$
答案 0 :(得分:1)
似乎是SELinux权限问题。要遵循的步骤:
restorecon -R -v /home/git/.ssh
usermod -s /bin/bash git
.ssh/config
编辑为:Host mysite.com User gitlab_username Hostname mysite.com PreferredAuthentications publickey IdentityFile /home/user/.ssh/id_rsa
尝试连接到gitlab服务器ssh -T git@mysite.com
。你应该看到一条欢迎你的消息。
我已将其添加到安装指南中。我有一个merge request准备好了几个增强功能。当gitlab 6.8发布时我会合并它。
答案 1 :(得分:0)
我认为您需要设置全局配置用户名和电子邮件
$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com
答案 2 :(得分:-1)
检查git用户是否具有您指定的无登录shell。根据建议将其更改为bash修复了我的问题(usermod -s /bin/bash git
)。