2013-07-19 132 views
14

我是gitlab和CI新手,所以我有很多问题,但其中一些通过谷歌,SO,git人解决,但不是最后一个...无法通过SSH克隆gitlab的回购,通过http - 好吧

如果我尝试通过HTTP克隆回购协议,我不能克隆通过ssh =(

回购:

[email protected]:/var/www$ git clone http://gitlab.vbox/root/virtualboxgitlab.git 
Cloning into 'virtualboxgitlab'... 
Username for 'http://gitlab.vbox': root 
Password for 'http://[email protected]': 
warning: You appear to have cloned an empty repository. 

没关系

但是通过ssh ...

[email protected]:/var/www$ git clone [email protected]:root/virtualboxgitlab.git 
Cloning into virtualbox 'gitlab' 
[email protected]'s password:<br /> 

它提示我混帐的密码,我没有创建在安装过程中(如我的人有)

rsa keys 

我通过gitlab的网站加入我的钥匙(占根,其实我没有创造任何其他帐户)

而且也是我所说的“猫my_rsa.pub >> authorized_keys的”

我读到这里几个职位有关SSH的烦恼,但大多数gitolite安装

添加关键

我安装gitlab 5.3没有gitolite(如手册),可能是我应该?

我也试过ssh -vT [email protected]它输出:

.... 
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 
[email protected]'s password: 


[email protected]:/home/git/.ssh# ls -l 
итого 4 
-rw------- 1 git git 922 Июл 18 21:05 authorized_keys 

environmetnt: 的debian 7,nginx的+乘客,gitlab 5.3,红宝石2.0.0p247,没有gitolite,对麒麟

请帮助美洲狮! =)却困...


一些补充(2013年7月20日):

我创建的用户的git在手动安装

sudo adduser --disabled-login --gecos 'GitLab' git 

第二天,我想杀混帐和useradd命令只是重新添加,在那之后我的钥匙都工作,但我仍然不开心,因为:

[email protected]:/var/www$ git clone [email protected]: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工作以及以往:

[email protected]:/var/www$ git clone http://gitlab.vbox/root/virtualboxgitlab.git 
Cloning into 'virtualboxgitlab'... 
Username for 'http://gitlab.vbox': root 
Password for 'http://[email protected]': 
warning: You appear to have cloned an empty repository. 

所以,现在我没有权威性的问题,但还有一个。

如何解决此问题?

+0

我已经编辑我的答案回应你的问题的编辑:) – VonC

回答

5

GitLab 5.x doesn't use gitolite anymore,但是gitlab-shell

我建议创建一个专用帐户,如installation process中的建议。

ssh [email protected] 

了SSH命令意味着你所要求的安全外壳上“gitlab.vbox”作为用户“git”。如果该用户不存在...它将无法工作。

没有必要去尝试和克隆回购是测试运行不正常:

sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production 

OP报告ssh可以创建git的用户并添加键后好转,但:

  • 首先请确保您在“客户”帐户上创建了您的密钥,而不是在~git/.ssh/id_rsa中:您正尝试从客户帐户中打开一个会话为gitgit是安装gitlab的帐户。
  • 然后,您应该将您的公钥注册到您通过gitlab gui声明的用户帐户的ssh页面中。你应该而不是useradd”ssh到根。

如果你看到这一点:

[email protected]:/var/www$ git clone [email protected]: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 [email protected]:virtualboxgitlab.git 

这是gitlab工作,知道在哪里virtualboxgitlab .git被存储(如其在gitlab.yml配置文件中指定的)

基本上,忘记根目录,并按照它的意图完整安装gitlab:在'git'帐户中。

的OP使它工作,他评论说:

root”是管理员命名空间,gitlab自动创建此URL,并没有它的克隆是不行的,现在一切克隆,我开始安装gitlab CI ,

的OP必须:

我的用户到sudo组,变干净安装,收到错误

/usr/local/lib/ruby/2.0.0/net/http.rb:878:in initialize': getaddrinfo: 
    Name or service not known (SocketError) 

无法解析主机名,添加gitlab.vbox/etc/hosts

+0

我folowed安装向导一步一步的,没有错误,只有:'Git为git用户配置? git:x:1001:1001:GitLab ,,,:/ home/git:/ bin/bash' – alexZT

+0

将我的用户添加到sudo组中,进行全新安装,收到错误' /usr/local/lib/ruby/2.0.0/net/http.rb:878:in'initialize':getaddrinfo:无法解析主机名的名称或服务未知(SocketError)',将gitlab.vbox添加到'/etc/hosts'现在我快乐了!=)关于回购路径的一个词,你告诉我不应该指定root /在路径中,我这样做,我应该,“根”是管理员命名空间,gitlab自动创建此网址,没有它克隆不起作用,现在一切克隆和我开始安装gitlab CI,非常感谢 – alexZT