user1053031
user1053031

Reputation: 747

Issue w/ Git push

I try to make a push on my new 14th Ubuntu installation.
Here is the console output it face:

>     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'

This is Java project. There is no relation to Ruby at all.
What have I broken here?

Upvotes: 1

Views: 136

Answers (3)

VonC
VonC

Reputation: 1328602

There is no relation to Ruby at all.

There is actually: you are pushing to a GitLab server (written in Ruby), and probably not with the right "project access" (introduced in 2014).
If master is protected, GitLab will reject the push.

That is what [remote rejected] master -> master (pre-receive hook declined) means.

See "GitLab Permissions": only a master or owner can push to a protected branch.

Here is what I see for the pre-receive hook set by GitLab:

[<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

The OP adds:

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.

The credentials associated with that new clone must be different from the ones used at the time in the first repo.

Upvotes: 3

user1053031
user1053031

Reputation: 747

Well, it seems that problem was from my side: i cloned my repo two month ago and didn't touch it since then till today. A couple of min. ago i cloned the same project into another location and now it seems that everything is fine. Thanx everyone for assist!

Upvotes: 1

Maksym Semenykhin
Maksym Semenykhin

Reputation: 1945

Look at those lines:

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

Pay attention to remote rejected and pre-receive hook declined

It seem like your repository has a pre-receive hook and it declined you push

More about git hooks link

AS VonC pointed below it can because of GitLab roles

Upvotes: 1

Related Questions