2012-04-05 79 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