【问题标题】:Gitlab 6.1 push Rejected / ErrorGitlab 6.1推送被拒绝/错误
【发布时间】:2013-10-27 22:13:39
【问题描述】:

在我使用 gitlab 5.3 之前一切正常。

现在我通过 5.4 和 6.0 升级到 gitlab 6.1,现在我无法推送。

在服务器上进行安装检查:

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:  git@git.gigadi.org: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

当我在本地机器上尝试时:

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

结果是:

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'

我在 debian 6.0.7 中使用 gitlab 和 apache

问题出在哪里?

【问题讨论】:

    标签: debian gitlab


    【解决方案1】:

    我这样解决我的问题:

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

    改变第一行

    #!/usr/bin/env ruby
    

    #!/usr/local/bin/ruby
    

    现在我的推送工作正常了!

    认为VonC

    【讨论】:

    • 感谢您的提示。我将 RVM 用于 git 以获得单独的 Ruby 环境。我的 hashbang 是 #!/home/git/.rvm/rubies/ruby-2.1.1/bin/ruby
    【解决方案2】:

    首先,使用 http url 推送意味着根本不涉及 ssh:

    • 设置GIT_SSH 没有区别。
    • 设置 GIT_CURL_VERBOSE=1 会影响 git push 的输出。

    其次,如issue 3373issue 2285issue https://github.com/gitlabhq/gitlabhq/issues/3349,...是ruby版本问题。

    我 99% 确定您已从 RVM 安装了 1.9.3,但您也安装了系统 ruby​​(检查 /usr/bin/ruby --version)。
    当您通过git@gitlab (ssh) 连接时 - 您正在启动 shell,因此 rvm 正在正确初始化和使用并且一切正常,但是当您通过 HTTP 运行时,gitlab 直接启动 gitlab-shell 并且由于某种原因 rvm 没有工作和使用系统版本

    【讨论】:

      【解决方案3】:

      正如上面斋月所说,我解决了我的问题 vim /home/git/gitlab-shell/hooks/update 将第一行从

      !/usr/bin/env ruby​​

      !/usr/local/bin/ruby

      【讨论】:

        猜你喜欢
        • 2019-03-24
        • 1970-01-01
        • 2019-03-29
        • 1970-01-01
        • 2017-01-09
        • 2021-09-22
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多