无法通过ssh克隆gitlab的repo,通过http - OK

ale*_*xZT 16 gitlab

我是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.
Run Code Online (Sandbox Code Playgroud)

没关系!

但是通过ssh ......

lesha@lesha-SeoTeam:/var/www$ git clone git@gitlab.vbox:root/virtualboxgitlab.git
Cloning into virtualbox 'gitlab'
git@gitlab.vbox's password:<br />   
Run Code Online (Sandbox Code Playgroud)

它提示我git的密码,我在安装过程中没有创建(就像我在man中一样)

rsa keys
Run Code Online (Sandbox Code Playgroud)

我通过gitlab的web添加了我的密钥(到帐户root,实际上我没有创建任何其他帐户)

而且我通过"cat my_rsa.pub >> authorized_keys"添加了密钥

我在这里看了几篇关于ssh麻烦的帖子,但大多数都安装了gitolite

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

我也尝试了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
Run Code Online (Sandbox Code Playgroud)

环境:debian 7,nginx +乘客,gitlab 5.3,ruby 2.0.0p247,没有gitolite,美洲狮对抗独角兽

请帮帮忙!=)我被困了......


一些补充(20.07.2013):

我在手动安装中创建了用户git

sudo adduser --disabled-login --gecos 'GitLab' git
Run Code Online (Sandbox Code Playgroud)

第二天,我试图杀死git并简单地通过useradd命令重新添加,之后我的键正在工作,但我仍然不高兴,因为:

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
Run Code Online (Sandbox Code Playgroud)

和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.
Run Code Online (Sandbox Code Playgroud)

所以,现在我没有auth问题,但有另一个问题.

你会如何从那里解决这个问题?

Von*_*onC 6

GitLab 5.x不再使用gitolite,但是gitlab-shell.

我建议按照安装过程中的建议创建一个专用帐户.

ssh git@gitlab.vbox
Run Code Online (Sandbox Code Playgroud)

那个ssh命令意味着你要求' gitlab.vbox'作为用户' 的安全shell git.如果该用户不存在......它将无法工作.

没有必要尝试克隆repo是测试运行不正常:

sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
Run Code Online (Sandbox Code Playgroud)

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

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

如果你看到这个:

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
Run Code Online (Sandbox Code Playgroud)

这也意味着你不应该指定repo(root/)的路径:

 git clone git@gitlab.vbox:virtualboxgitlab.git
Run Code Online (Sandbox Code Playgroud)

知道virtualboxgitlab.git存储的位置是gitlab的工作(在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)
Run Code Online (Sandbox Code Playgroud)

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