Cannot push code to gitlab after upgraded to v7.8 from v6.9 and how to fix
After we upgraded our gitlab server to v7.8 from v6.9, we could not push code to it and always got this error:
...
remote: /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.8.3/lib/bundler/shared_helpers.rb:2:in `require': no such file to load -- rubygems (LoadError)
remote: from /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.8.3/lib/bundler/shared_helpers.rb:2
remote: from /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.8.3/lib/bundler/setup.rb:1:in `require'
remote: from /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.8.3/lib/bundler/setup.rb:1
To http://our.repo.url/myusername/my-project.git
! [remote rejected] my_branch -> my_branch (pre-receive hook declined)
...
...
remote: /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.8.3/lib/bundler/shared_helpers.rb:2:in `require': no such file to load -- rubygems (LoadError)
remote: from /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.8.3/lib/bundler/shared_helpers.rb:2
remote: from /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.8.3/lib/bundler/setup.rb:1:in `require'
remote: from /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.8.3/lib/bundler/setup.rb:1
To http://our.repo.url/myusername/my-project.git
! [remote rejected] my_branch -> my_branch (pre-receive hook declined)
...
I was trying to re-compile ruby 2.1 so many times but had no luck. After messing around, I finally fixed this issue by:
1. Remove and Purge all ruby binaries except for ruby 2.1 from my server:
sudo apt-get remove ruby1.8
sudo apt-get remove ruby1.9.1 libruby1.9.1
sudo aptitude purge ruby ruby1.9.1 libruby1.9.1
sudo rm -rf /home/git/gitlab/vendor/bundle/ruby/1.9.1
sudo rm -rf /home/git/gitlab/vendor/bundle/ruby/2.0.0
(you can also delete the gem cache in /home/git/gitlab/vendor/bundle/ruby/2.1.0/cache/)
2. Create a symlink for /usr/local/bin/ruby to /usr/bin/ruby:
sudo ln -s /usr/local/bin/ruby /usr/bin/ruby
(I had to delete the existing ruby binary in /usr/bin/ruby because it still said that it's v1.8?)
3. Uninstall bundle and re-install it again:
sudo gem uninstall bundler
sudo gem install bundler
4. Re-install gems for gitlab:
sudo -u git -H bundle install --deployment --without development test postgres aws
5. Restart gitlab:
sudo service gitlab restart
And prolem fixed!!!
References:
Comments
Post a Comment