问题与 Git 推送
Issue w/ Git push
我尝试推动我的第 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 完全没有关系。
我在这里破坏了什么?
There is no relation to Ruby at all.
实际上有:你正在推送到a GitLab server (written in Ruby), and probably not with the right "project access" (introduced in 2014)。
如果 master
受到保护,GitLab 将拒绝推送。
这就是[remote rejected] master -> master (pre-receive hook declined)
的意思。
参见“GitLab Permissions”:只有 master
或 owner
可以推送到受保护的分支。
这是我看到的 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 添加:
I cloned my repo two month ago and didn't touch it since then till today.
A couple of minutes ago, I cloned the same project into another location and now it seems that everything is fine.
与该新克隆关联的凭据必须不同于第一个存储库中当时使用的凭据。
看看那些行:
> To http://gitlab.loc/group/cab.git ! [remote rejected] master ->
> master (pre-receive hook declined) error: failed to push some refs to
关注remote rejected
和pre-receive hook declined
您的存储库似乎有一个预接收挂钩,它拒绝了您的推送
AS VonC pointed it can because of GitLab roles
好吧,看来问题出在我这边:我两个月前克隆了我的存储库,从那以后直到今天都没有碰过它。几分钟。之前我将同一个项目克隆到另一个位置,现在看来一切都很好。谢谢大家的帮助!
我尝试推动我的第 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 完全没有关系。
我在这里破坏了什么?
There is no relation to Ruby at all.
实际上有:你正在推送到a GitLab server (written in Ruby), and probably not with the right "project access" (introduced in 2014)。
如果 master
受到保护,GitLab 将拒绝推送。
这就是[remote rejected] master -> master (pre-receive hook declined)
的意思。
参见“GitLab Permissions”:只有 master
或 owner
可以推送到受保护的分支。
这是我看到的 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 添加:
I cloned my repo two month ago and didn't touch it since then till today.
A couple of minutes ago, I cloned the same project into another location and now it seems that everything is fine.
与该新克隆关联的凭据必须不同于第一个存储库中当时使用的凭据。
看看那些行:
> To http://gitlab.loc/group/cab.git ! [remote rejected] master ->
> master (pre-receive hook declined) error: failed to push some refs to
关注remote rejected
和pre-receive hook declined
您的存储库似乎有一个预接收挂钩,它拒绝了您的推送
AS VonC pointed
好吧,看来问题出在我这边:我两个月前克隆了我的存储库,从那以后直到今天都没有碰过它。几分钟。之前我将同一个项目克隆到另一个位置,现在看来一切都很好。谢谢大家的帮助!