2012-04-05 78 views
4

我能够使用这些指令设置VirtualBox与Gitlab - >https://github.com/gitlabhq/gitlabhq/wiki/VirtualBox-Image。 Web界面工作得很好,我添加了我的主机公钥并创建了一个“测试”项目。但是,我无法推送到我的测试存储库,因为它在制作测试目录并执行'git init'之后要求输入[email protected]的密码。我已经添加了我的密钥,并且Web界面工作得很好。任何想法可能是错的?Gitlab git推送失败与流浪汉管理的Virtualbox

$ git remote add test [email protected]:test.git 
$ git push -u test master 
[email protected]'s password: ... 

我相同的结果(2222 VM-侧等于22主机端)试过这也:

git remote add test ssh://[email protected]:2222/test.git 
git push -u test master 
[email protected]'s password:... 

不应该要求密码。我还将'vagrant'用户添加到VM上的'git'组。

我验证过的VM我能够正确地接收低于预期的结果:

[email protected]:~$ ssh -T [email protected] 
hello rails, this is gitolite v2.2-11-g8c4d1aa running on git 1.7.0.4 
the gitolite config gives you the following access: 
    R W gitolite-admin 
    @R_ @W_ testing 

这里是我的VagrantFile:

Vagrant::Config.run do |config| 
config.vm.box = "gitlab" 
config.vm.network :hostonly, "33.33.33.10" 
end 

这有事情做与远程混帐推到virtualbox。谢谢您的帮助!

+0

我试图添加端口2222到/ etc/ssh/sshd_config和使用por t 2222在config/gitlab.yml中,但无济于事。当我尝试从主机推送到VM时,它仍然要求提供git @ localhost的密码。有任何想法吗?? – PhilBot 2012-04-06 22:40:09

回答

0

我使用不在虚拟机中的gitlabhq_install脚本进行了全新安装,并且出现了原始相同的问题。我能够创建一个项目,并通过Web界面添加我的密钥,但根本无法推到测试仓库。所以我通过运行“ssh-copy-id -i〜/ .ssh/id_rsa.pub remote-host”添加了我的用户(不是gitlabhq用户)public ssh密钥,并重新启动了ssh。我仍然遇到了同样的问题,所以我'sudo vim /home/git/.ssh/authorized_keys'并手动将添加了上述命令的密钥复制到'#gitolite start/end'标签之间。重置ssh后,才终于推动...现在我仍然在挠我的脑袋,但至少它工作我猜。

0

看起来您的密钥并未发送到虚拟机。你可以检查你的用户.ssh目录中是否有正确的id_rsa和id_rsa.pub文件。这可能是非常成问题的,如果你在窗户上运行vagrant(http://vagrantup.com/docs/getting-started/ssh.html

希望这会有所帮助。

+0

是的,我已经在主机上为我的用户添加了我的公共ssh密钥到web浏览器中的gitlab接口。我为主机和虚拟机运行Ubuntu。我可以和我的流浪者一起甩开机器就好了。在虚拟机本身上,我似乎无法推送......这很奇怪,因为gitolite已在gitlab中注册,因为我可以在网页浏览器gitlab界面中添加键和新项目。但是,如果(作为运行gitlab的用户),我尝试从测试目录中推入git,然后获得'vagrant @ lucid32:〜/ test2 $ git push 将test2拒绝到rails'的W访问权限。任何其他想法? – PhilBot 2012-04-08 18:34:22

1

我有一些严重的问题让流浪机器启动并运行。首先,它没有使用与代码相同的默认值(参见#1)。它使用rvm(见#3)

  1. 流浪VM决定使用“vagrant”而不是“git”作为用户。
    所以你的回购网址是真的:
    SSH:// 流浪汉 @localhost:2222/test.git

  2. 我加了的〜/ .ssh/config中(CHMOD 600):
    主机*
    用户流浪汉
    IdentityFile的〜/ .ssh/id_rsa`

  3. 如果你过去这,你可能会得到关于“在/ usr/bin中/ env的红宝石找不到文件”的错误,因为你正在使用流浪者,它使用rvm。
    我不得不这样做这两件事情:

0

我有同样的问题,当我试图推送到gitlab.com:

git push gitlab mybranch 

推happend用下面的流浪汉代码

​​

出现下列错误:

==> default: GitLab: The project you were looking for could not be found. 
==> default: fatal: Could not read from remote repository. 
==> default: 
==> default: Please make sure you have the correct access rights 
==> default: and the repository exists. 

我的解决办法是把应当由流浪汉在shell脚本执行的代码,并把这种一个特权的外壳包装在su

config.vm.provision :shell, :name => "Workaround to run update-repo.sh as vagrant user", :keep_color => true, :privileged => true, :inline => <<-SHELL 
    su - vagrant -c /home/vagrant/bin/push.sh 
    SHELL