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!
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.
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)
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
I added a ~/.ssh/config (chmod 600):
Host *
User vagrant
IdentityFile ~/.ssh/id_rsa`
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:
env | grep -E "^(GEM_HOME|PATH|RUBY_VERSION|MY_RUBY_HOME|GEM_PATH)=" > ~/.ssh/environment
PermitUserEnvironment yes
to sshd_config + restartit 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.
vagrant@lucid32:~/test2$ git push
W access for test2 DENIED to rails
. Any other ideas - PhilBot 2012-04-08 18:34
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