我是 gitlab 和 CI 的新手,所以我有很多问题,但其中一些问题是通过 google、SO、git mans 解决的,但不是最后一个……
我无法通过 ssh 克隆 repo =(
如果我尝试通过 http 克隆 repo:
lesha@lesha-SeoTeam:/var/www$ git clone http://gitlab.vbox/root/virtualboxgitlab.git
Cloning into 'virtualboxgitlab'...
Username for 'http://gitlab.vbox': root
Password for 'http://root@gitlab.vbox':
warning: You appear to have cloned an empty repository.
没关系!
但是通过 ssh ...
lesha@lesha-SeoTeam:/var/www$ git clone git@gitlab.vbox:root/virtualboxgitlab.git
Cloning into virtualbox 'gitlab'
git@gitlab.vbox's password:<br />
它提示我 git 的密码,我没有在安装过程中创建(就像我在 man 中那样)
rsa keys
我通过 gitlab 的 web 添加了我的 key (到 root 帐户,实际上我没有创建任何其他帐户)
我还通过“cat my_rsa.pub >>authorized_keys”添加了 key
我在这里读了几篇关于 ssh 问题的帖子,但大多数都安装了 gitolite
我安装了没有 gitolite 的 gitlab 5.3(如手册中所示),我应该这样做吗?
我也试过
ssh -vT git@gitlab.vbox
它输出:....
debug1: Server host key: ECDSA 48:83:ba:b3:37:72:a0:dc:ca:2c:a3:b8:78:a1:c4:ad
debug1: Host 'gitlab.vbox' is known and matches the ECDSA host key.
debug1: Found key in /home/lesha/.ssh/known_hosts:2
debug1: ssh_ecdsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/lesha/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/lesha/.ssh/id_dsa
debug1: Trying private key: /home/lesha/.ssh/id_ecdsa
debug1: Next authentication method: password
git@gitlab.vbox's password:
root@seotm-server:/home/git/.ssh# ls -l
итого 4
-rw------- 1 git git 922 Июл 18 21:05 authorized_keys
环境:
debian 7,nginx + 乘客,gitlab 5.3,ruby 2.0.0p247,没有 gitolite,puma 对抗 unicorn
请帮忙!=)我被卡住了...
一些补充(20.07.2013):
我在手动安装中创建了用户 git
sudo adduser --disabled-login --gecos 'GitLab' git
第二天,我试图杀死 git 并通过
useradd
简单地重新添加命令,在那之后我的 key 正在工作,但我仍然不高兴,因为:lesha@lesha-SeoTeam:/var/www$ git clone git@gitlab.vbox:root/virtualboxgitlab.git
Cloning into 'virtualboxgitlab'...
fatal: 'root/virtualboxgitlab.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
和 http 的工作原理和以前一样:
lesha@lesha-SeoTeam:/var/www$ git clone http://gitlab.vbox/root/virtualboxgitlab.git
Cloning into 'virtualboxgitlab'...
Username for 'http://gitlab.vbox': root
Password for 'http://root@gitlab.vbox':
warning: You appear to have cloned an empty repository.
所以,现在我没有身份验证问题,但有另一个问题。
您将如何从那里解决此问题?
最佳答案
GitLab 5.x doesn't use gitolite anymore ,但是 gitlab-shell
.
我建议按照 installation process 中的建议创建一个专用帐户。 .
ssh git@gitlab.vbox
该 ssh 命令意味着您要求在“
gitlab.vbox
”上使用安全 shell 。 ' 作为用户 ' git
'。如果该用户不存在......它将无法工作。如果测试无法正常运行,则无需尝试克隆 repo:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
OP报告 ssh 在创建 git 用户并添加 key 后工作得更好,但是:
~git/.ssh/id_rsa
中: 您正在尝试以 git
身份打开 session ,来自客户帐户。 git
是安装 gitlab 的帐户。 useradd
” ssh 到 root。 如果你看到这个:
lesha@lesha-SeoTeam:/var/www$ git clone git@gitlab.vbox:root/virtualboxgitlab.git
Cloning into 'virtualboxgitlab'...
fatal: 'root/virtualboxgitlab.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
这也意味着您不应指定存储库的路径(
root/
): git clone git@gitlab.vbox:virtualboxgitlab.git
gitlab 的工作是知道 virtualboxgitlab.git 的存储位置(如其
gitlab.yml
配置文件中所述)基本上,忘根 ,并按照预期执行 gitlab 的完整安装:在“
git
”中' 帐户。OP 使它起作用,并评论说:
"
root
" is administrators namespace, gitlab creates this url automatically and without it clone doesn't work, now everything clones and I begin to install gitlab CI,
OP 必须:
add my user to sudo group, made clean install, received error
/usr/local/lib/ruby/2.0.0/net/http.rb:878:in initialize': getaddrinfo:
Name or service not known (SocketError)
无法解析主机名,添加
gitlab.vbox
至 /etc/hosts
关于gitlab - 无法通过 ssh、http 克隆 gitlab 的 repo - 好的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17739978/