【问题标题】:Password for GitLabGitLab 的密码
【发布时间】:2016-02-03 06:35:20
【问题描述】:

我已经按照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 密钥。

编辑。请确认我应该将这些密钥添加到 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 ~]$

【问题讨论】:

    标签: linux git centos gitlab


    【解决方案1】:

    似乎是 SELinux 权限问题。后续步骤:

    1. restorecon -R -v /home/git/.ssh
    2. usermod -s /bin/bash git
    3. 将您的家庭计算机用户的.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 发布的时候合并它。

    【讨论】:

    • 谢谢阿西尔。目前,我的 SELinux 处于许可模式。请在我的原始帖子中查看我的 EDIT 2。想法?我按照建议对 .ssh/config 进行了更改。对客户端执行此操作,而不是 GitLab 服务器,对吗?得到错误Bad owner or permissions on /home/Michael/.ssh/config。我应该使用哪个用户?吉特?我的客户用户?谢谢!
    • 没错。您应该使用登录 gitlab 的用户。顺便说一句,CentOS 有一个更新的指南 :)
    • 感谢 Axil,我将按照更新后的指南重新开始,看看会发生什么。你认为我需要走多远(即我应该yum remove 什么)?此外,我配置 Apache 的方式与指南推荐的方式不同。请参阅stackoverflow.com/questions/23227851/…。谢谢
    • 我认为您不需要卸载任何东西。
    • 再次感谢 Axil,你有机会看看stackoverflow.com/questions/23227851/…吗?
    【解决方案2】:

    我认为您需要设置全局配置用户名和电子邮件

    $ git config --global user.name "John Doe"
    $ git config --global user.email johndoe@example.com
    

    【讨论】:

      【解决方案3】:

      检查 git 用户是否有您指定的无登录 shell。按照建议将其更改为 bash 解决了我的问题 (usermod -s /bin/bash git)。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-11-01
        • 2020-05-20
        • 2013-03-07
        • 2014-07-21
        • 2014-11-20
        • 1970-01-01
        • 2019-10-04
        • 2015-08-06
        相关资源
        最近更新 更多