Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gitlab 6.1 push Rejected / Error

Tags:

gitlab

debian

Before i use gitlab 5.3 and all works fine.

Now i upgrade to gitlab 6.1 via 5.4 and 6.0 and now i can't push.

İnstallation check on server:

root@ks:/home/git/gitlab# sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production

System information
System:     Debian 6.0.7
Current User:   git
Using RVM:  no
Ruby Version:   1.9.3p327
Gem Version:    2.1.8
Bundler Version:1.3.5
Rake Version:   10.1.0

GitLab information
Version:    6.1.0
Revision:   b595503
Directory:  /home/git/gitlab
DB Adapter: mysql2
URL:        http://git.gigadi.org
HTTP Clone URL: http://git.gigadi.org/some-project.git
SSH Clone URL:  [email protected]:some-project.git
Using LDAP: no
Using Omniauth: no

GitLab Shell
Version:    1.7.1
Repositories:   /home/git/repositories/
Hooks:      /home/git/gitlab-shell/hooks/
Git:        /usr/bin/git



root@ks:/home/git/gitlab# sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
Checking Environment ...

Git configured for git user? ... yes
Has python2? ... yes
python2 is supported version? ... yes

Checking Environment ... Finished

Checking GitLab Shell ...

GitLab Shell version >= 1.7.1 ? ... OK (1.7.1)
Repo base directory exists? ... yes
Repo base directory is a symlink? ... no
Repo base owned by git:git? ... yes
Repo base access is drwxrws---? ... yes
update hook up-to-date? ... yes
update hooks in repos are links: ... 


Checking GitLab Shell ... Finished

Checking Sidekiq ...

Running? ... yes

Checking Sidekiq ... Finished

Checking GitLab ...

Database config exists? ... yes
Database is SQLite ... no
All migrations up? ... yes
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Init script exists? ... yes
Init script up-to-date? ... yes
projects have namespace: ... 

Projects have satellites? ... 

Redis version >= 2.0.0? ... yes
Your git bin path is "/usr/bin/git"
Git version >= 1.7.10 ? ... yes (1.8.3)

Checking GitLab ... Finished

When i try in my local machine:

GIT_SSH='ssh -v' git push -f http://mydomain.org/xxx/xxx.git master

The result is:

Counting objects: 154, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (135/135), done.
Writing objects: 100% (154/154), 184.75 KiB, done.
Total 154 (delta 22), reused 0 (delta 0)
remote: /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/dsl.rb:33:in `eval_gemfile': Gemfile syntax error: (Bundler::GemfileError)
remote: /home/git/gitlab/Gemfile:14: syntax error, unexpected ':', expecting $end
remote: gem "mysql2", group: :mysql
remote:                     ^
remote:     from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/dsl.rb:9:in `evaluate'
remote:     from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/definition.rb:19:in `build'
remote:     from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler.rb:148:in `definition'
remote:     from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler.rb:116:in `setup'
remote:     from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/setup.rb:17
remote: error: hook declined to update refs/heads/master
To http://mydomain.org/xxx/xxx.git
 ! [remote rejected] master -> master (hook declined)
error: failed to push some refs to 'http://mydomain.org/xxx/xxx.git'

i Use gitlab in debian 6.0.7 with apache

Where is the probleme?

like image 597
RaKoDev Avatar asked Oct 18 '13 23:10

RaKoDev


People also ask

How to push to protected branches in GitLab?

It's not possible to push to protected branches. Using GitLab 13.1.0 CE. This did not happen in 13.0.6. Install Omnibus GitLab. Provide a pre-receive hook that accepts all commits. Put it into /opt/gitlab/embedded/service/gitlab-shell/hooks/pre-receive.d directory. Create a repository (empty or not).

Is GitLab Community Edition compatible with Git Bash 64 bit?

Using GitLab Community Edition version 11.4.0 installed on a Linux server and Git Bash version 2.19.1 64-bit for Windows. I created a project in the GitLab UI and attempted a push from the local repository to this project, for which I have Maintainer status. The error message looks like it has nothing to do with gitlab, but it is a pure git thing.

What should I avoid when answering a question on GitLab?

But avoid … Asking for help, clarification, or responding to other answers. Making statements based on opinion; back them up with references or personal experience. To learn more, see our tips on writing great answers. Not the answer you're looking for? Browse other questions tagged gitlab push or ask your own question.

How to push a branch that is behind in Git?

As the message says, your branch is behind, so do a git pull to get he latest from the server, resolve any conflicts, and then you'll be able to push. I tried git pull origin master and it result From gitlab.com:RamS20_2/myfirstgittrial * branch master -> FETCH_HEAD Already up-to-date. and i also try to push but i got same error. git add .


2 Answers

I solve my problem like this:

vim /home/git/gitlab-shell/hooks/update

change first line from

#!/usr/bin/env ruby

TO

#!/usr/local/bin/ruby

Now my push work fine!

Thinks VonC

like image 173
RaKoDev Avatar answered Sep 17 '22 23:09

RaKoDev


First, pushing with an http url means ssh isn't involved at all:

  • Setting GIT_SSH makes no difference.
  • Setting GIT_CURL_VERBOSE=1 would make a difference in the output of the git push.

Second, as illustrated by issue 3373, issue 2285, issue https://github.com/gitlabhq/gitlabhq/issues/3349, ... it is a ruby version issue.

I am 99% sure that you have 1.9.3 installed from RVM but you have also system ruby (check /usr/bin/ruby --version).
When you connect trough git@gitlab (ssh) - you are launching shell so rvm is being properly initialized and used and everything works but when you run through HTTP, gitlab is launching gitlab-shell directly and for some reason rvm doesn't work and the system version is used.

like image 42
VonC Avatar answered Sep 17 '22 23:09

VonC