8

I'm recently trying to start my own project on a community git repo, and I've been having some complications. I'm new to git, but here's what I've been trying to do to just test it.

I run the following commands and they all run ok.

git config --global user.name "MYNAME"
git config --global user.email "MYEMAIL"
mkdir testproject
cd testproject
git init
touch README
git add README
git commit -m 'first commit'
git remote add origin git@git.xxxxx.org:community/testproject.git

and all of the above commands run with no error. However, when I the run the next command I get a huge error.

git push -u origin master

and the error is.

Counting objects: 3, done.
Writing objects: 100% (3/3), 204 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
Username for 'http://git.xxxxxx.org': MYEMAIL
Password for 'http://MYEMAIL.com@git.xxxxxx.org': 
remote: /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/spec_set.rb:92:in `block in materialize': Could not find rake-10.1.0 in any of the sources (Bundler::GemNotFound)
remote:         from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/spec_set.rb:85:in `map!'
remote:         from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/spec_set.rb:85:in `materialize'
remote:         from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/definition.rb:114:in `specs'
remote:         from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/definition.rb:159:in `specs_for'
remote:         from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/definition.rb:148:in `requested_specs'
remote:         from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/environment.rb:18:in `requested_specs'
remote:         from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:13:in `setup'
remote:         from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler.rb:120:in `setup'
remote:         from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/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'
remote: error: hook declined to update refs/heads/master
To http://git.xxxxxx.org/community/testproject.git
 ! [remote rejected] master -> master (hook declined)
error: failed to push some refs to 'http://git.xxxxxx.org/community/testprojact.git'

I'm not really sure what to do from here, but any help is much appreciated.

Also, I'm running Arch if it matters.

Edit: I've tried re-installing rake and it didn't work. My current version of rake was 10.1.1, so I tried removing it and replacing it with version 10.1.0 and that also didn't fix it.

However when I was installing rake, I got an error:

WARNING:  You don't have /home/josh/.gem/ruby/2.0.0/bin in your PATH,
          gem executables will not run.

Could this be contributing to the problem?

9

That the remote declined to receive the data is only a side effect of the real problem -- git thinks that it was denied because one of the hooks on the remote end failed with an exit status >0 (you can see what it was in the Ruby traceback). It seems that one of the hooks tries to use rake, and can't find it. This is not a problem with your specific repo, probably. That message is also not from your local computer -- notice that it is prefixed with "remote", it is the remote that is missing rake, so probably only a sysadmin on that side can fix the issue.

I would suggest you contact whoever manages your community git repository.

  • That's exactly what I was thinking. None of the hooks in my git repo are active, and so far nothing I've done even seems to change the error or create new ones. I'll contact the owner of the repo and see if he has any information on the problem. – Joshua Strot Dec 21 '13 at 5:33
  • Turn out the problem was, I was trying to push over the HTTP method which is unsupported on their GitLab. You have to push over SSH instead, which works wonderfully. I've got to say, I didn't expect that, – Joshua Strot Dec 21 '13 at 10:54
0

I believe this is your issue.

remote: error: hook declined to update refs/heads/master
To http://git.xxxxxx.org/community/testproject.git
 ! [remote rejected] master -> master (hook declined)

Search for this error I came across this Q&A on SO, titled: error: hook declined to update refs/heads/external_pub while pushing a branch.

It would appear that there's a git hook on the server that's rejecting the push.

excerpt

Server-Side Hooks

In addition to the client-side hooks, you can use a couple of important server-side hooks as a system administrator to enforce nearly any kind of policy for your project. These scripts run before and after pushes to the server. The pre hooks can exit non-zero at any time to reject the push as well as print an error message back to the client; you can set up a push policy that’s as complex as you wish.

To determine why you're getting this error message you'll need to figure out which hook is tripping you up. Hooks are stored in the hooks folder inside the git folder (on the remote server end) - find the pre-receive hook or update hook and check to see what's causing your problem.

  • Inside of my hooks folder, I have multiple files with the .sample extension. I don't have a pre-receive hook, however there is a update hook. Since they all have the .sample extension though, I don't believe any of them are in use, so could it be that it's a hook on the server that's rejecting me? I looked online and there's a couple of people with my problem that have fixed it by doing various things, none of which fixed it in my case. – Joshua Strot Dec 21 '13 at 5:25
0

Check role/group and permission in GIT repository My case, only red permission and its resolved after read/write access provided by GIT repository team

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.