Gitlab git push failing with Vagrant-managed Virtualbox

Go To StackoverFlow.com

4

I was able to setup Virtualbox with Gitlab using these instructions --> https://github.com/gitlabhq/gitlabhq/wiki/VirtualBox-Image. The web interface works just fine and I have added my host public key and created a 'test' project. However, I am unable to push to my test repository since it asks for git@33.33.33.10's password after making a test directory and doing a 'git init'. I have added my key and the web interface works just fine. Any ideas what could be wrong?

$ git remote add test git@33.33.33.10:test.git
$ git push -u test master
git@33.33.33.10's password: ...

I've tried this as well with the same results ( 2222 VM-side equals 22 Host-side):

git remote add test ssh://git@localhost:2222/test.git
git push -u test master
git@localhost's password:...

Should not require a password. I have also added the 'vagrant' user to the 'git' group on the VM.

I've verified that on the VM I am able to correctly receive the expected results below:

vagrant@lucid32:~$ ssh -T git@localhost
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

Here is my VagrantFile:

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

This has something to do with remote git pushing to virtualbox. Thanks for the help!

2012-04-05 20:25
by PhilBot
I've tried to add Port 2222 to /etc/ssh/sshd_config and use port 2222 in config/gitlab.yml but to no avail. It is still asking for git@localhost's password when I try to push from the Host to the VM. Any ideas? - PhilBot 2012-04-06 22:40


0

I did a brand new install using the gitlabhq_install scripts not in a virtual machine and had the original same issue. I was able to create a project and add my key via the web interface but could not push at all to a test repo. So I added my user (not the gitlabhq user) public ssh key by running "ssh-copy-id -i ~/.ssh/id_rsa.pub remote-host" and restarted ssh. I still got the same issue so I 'sudo vim /home/git/.ssh/authorized_keys' and manually copied my key that was added with the above command to between the '#gitolite start/end' tags. After resetting ssh only then was I able to finally push... now I am still scratching my head but at least it works I guess.

2012-04-09 19:59
by PhilBot


1

I had some serious issues getting the vagrant machine up and running. For one, it doesn't use the same defaults that the code expects (see #1). It uses rvm (see #3)

  1. The vagrant VM decides to use "vagrant" rather than "git" as the user.
    So your repo URL is really:
    ssh://vagrant@localhost:2222/test.git

  2. I added a ~/.ssh/config (chmod 600):
    Host *
    User vagrant
    IdentityFile ~/.ssh/id_rsa`

  3. If you get past this, you'll probably get an error about "/usr/bin/env ruby could not find file", since you are using vagrant, which uses rvm.
    I had to do these two things:

2013-07-10 12:58
by Jason K


0

it seems that your keys aren't sent to the virtual machine. Can you check that you have correct id_rsa and id_rsa.pub files in your users .ssh directory. This can be very problematic if you are running vagrant on windows (http://vagrantup.com/docs/getting-started/ssh.html)

Hope this will help.

2012-04-07 23:09
by zveljkovic
Yes I've added my public ssh keys for my user on the host machine to the gitlab interface in the web browser. I am running Ubuntu for both host and vm,. I can ssh to the machine with my vagrant user just fine. On the virtual machine itself I cannot seem to push either... which is strange since gitolite is registered with gitlab as I can add keys and make new projects from within the web browser gitlab interface. However, if (as the user that runs gitlab) I try to git push from a test directory.. then I getvagrant@lucid32:~/test2$ git push W access for test2 DENIED to rails. Any other ideas - PhilBot 2012-04-08 18:34


0

i had the same problem, while i was trying to push to gitlab.com:

git push gitlab mybranch

pushing happend with the following vagrant code

  config.vm.provision :shell, :name => "pushing to remote", :keep_color => true, :privileged => false, :inline => <<-SHELL
        ---snip---
        git push gitlab mybranch
        ---snip---
  SHELL

the following error occured:

==> 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.

my solution was to put the code which should be executed by vagrant in a shell script and call this with a privileged shell wrapped in a 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
2016-10-07 13:11
by c33s
Ads