问题与Git推

时间:2016-07-04 07:37:42

标签: git gitlab

我尝试推动我的第14次Ubuntu安装 这是它面临的控制台输出:

>     host@host:~/repo/cab$ git push origin master Counting objects: 46, done. Delta compression using up to 4 threads. Compressing objects:
> 100% (9/9), done. Writing objects: 100% (13/13), 957 bytes | 0
> bytes/s, done. Total 13 (delta 6), reused 0 (delta 0) remote:
> /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler/spec_set.rb:92:in
> `block in materialize': Could not find rake-10.3.2 in any of the
> sources (Bundler::GemNotFound) remote:    from
> /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler/spec_set.rb:85:in
> `map!' remote:    from
> /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler/spec_set.rb:85:in
> `materialize' remote:     from
> /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler/definition.rb:132:in
> `specs' remote:   from
> /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler/definition.rb:177:in
> `specs_for' remote:   from
> /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler/definition.rb:166:in
> `requested_specs' remote:     from
> /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler/environment.rb:18:in
> `requested_specs' remote:     from
> /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler/runtime.rb:13:in
> `setup' remote:   from
> /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler.rb:121:in
> `setup' remote:   from
> /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler/setup.rb:17:in
> `<top (required)>' remote:    from
> /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' remote:
>   from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
> To http://gitlab.loc/group/cab.git  ! [remote rejected] master ->
> master (pre-receive hook declined) error: failed to push some refs to
> 'http://gitlab.loc/group/cab.git'

这是Java项目。根本没有与Ruby有任何关系 我在这里打破了什么?

3 个答案:

答案 0 :(得分:3)

  

与Ruby完全无关。

实际上:你正在推动a GitLab server(用Ruby编写),可能没有正确的&#34;项目访问&#34; (introduced in 2014)。
如果master受到保护,GitLab将拒绝推送。

这就是[remote rejected] master -> master (pre-receive hook declined)的含义。

请参阅&#34; GitLab Permissions&#34;:只有masterowner才能推送到受保护的分支机构。

以下是我对GitLab设置的pre-receive挂钩的看法:

[<gitlab-server>:/path/to/gitlab-shell/hooks] $ more pre-receive
#!/usr/bin/env ruby

# This file was placed here by GitLab. It makes sure that your pushed commits
# will be processed properly.

refs = ARGF.read
key_id  = ENV['GL_ID']
repo_path = Dir.pwd

require_relative '../lib/gitlab_custom_hook'
require_relative '../lib/gitlab_access'

if GitlabAccess.new(repo_path, key_id, refs).exec &&
    GitlabCustomHook.new.pre_receive(refs, repo_path)
  exit 0
else
  # reset GL_ID env since we stop git push here
  ENV['GL_ID'] = nil

  exit 1
end

OP补充道:

  

我两个月前克隆了我的仓库,从那时起直到今天都没碰过它   几分钟前,我将同一个项目克隆到另一个地方,现在看来一切都很好。

与新克隆关联的凭据必须与第一个回购时使用的凭据不同。

答案 1 :(得分:1)

看看这些内容:

> To http://gitlab.loc/group/cab.git  ! [remote rejected] master ->
> master (pre-receive hook declined) error: failed to push some refs to

注意remote rejectedpre-receive hook declined

您的存储库似乎有一个预接收挂钩而且拒绝推送

More about git hooks link

AS VonC指向below,因为GitLab roles

答案 2 :(得分:1)

好吧,似乎问题出在我身边:两个月前我克隆了我的回购,从那时起直到今天都没碰过它。几分钟以前我把同一个项目克隆到另一个地方,现在看来一切都很好。谢谢大家的帮助!