17

I have set up my own server (at home) and i am reaching it via putty on my main PC.

Gitlab is installed and configured, i can reach gitlab and log in. But when i try to push files (through HTTP) to my own project i get this message:

POST git-receive-pack (381 bytes)
remote: GitLab: You are not allowed to access master![K
remote: error: hook declined to update refs/heads/master[K
To http://myserver.com/root/push2jump.git
 ! [remote rejected] master -> master (hook declined)
error: failed to push some refs to 'http://myserver.com/root/push2jump.git'

I am using HTTP instead of SSH because there i get "Access denied", so basically neither is working.

When i run

sudo bundle exec rake gitlab:check RAILS_ENV=production

It tells me that the Sidekiq script is not running (which i can't seem to fix, not sure if it's related to this problem) Ofcourse it tells me that the repository is empty. The rest seems fine.

I checked

.ssh/authorized_keys

Which seem correct as well, the key there is the same as my saved key.

And my repos_path in gitlab-shell/config.yml looks good, not using symlink:

repos_path: /home/git/repositories/

I have run the official gitlab installation guide.

Can anyone help me with this problem? Thanks in advance

UPDATE

System information
System:         Ubuntu 12.04
Current User:   git
Using RVM:      no
Ruby Version:   2.0.0p481
Gem Version:    2.0.14
Bundler Version:1.6.2
Rake Version:   10.3.1
Sidekiq Version:2.17.0

GitLab information
Version:        6.9.2
Revision:       e46b644
Directory:      /home/git/gitlab
DB Adapter:     mysql2
URL:            ***
HTTP Clone URL: ***/some-project.git
SSH Clone URL:  ***:some-project.git
Using LDAP:     no
Using Omniauth: no

GitLab Shell
Version:        1.9.4
Repositories:   /home/git/repositories/
Hooks:          /home/git/gitlab-shell/hooks/
Git:            /usr/local/bin/git
3
  • Looks a bit similar to github.com/gitlabhq/gitlabhq/issues/7025 and github.com/gitlabhq/gitlabhq/issues/6623 (what Gitlab version are you using?)
    – VonC
    Commented May 31, 2014 at 18:01
  • Thanks for you reply, i updated my question with the system information. Those issues seem to happen when using LDAP, which i am not. But i will look into it, you never know.
    – AuStrike
    Commented May 31, 2014 at 18:55
  • Sounds like a server-side hook rejected the push. Perhaps the master branch was locked on GitLab, and you didn't have master access to the repo?
    – Ajedi32
    Commented Jun 5, 2014 at 14:24

4 Answers 4

37

I had this problem because I had master as a protected branch

Protect branch won't accept push

Once I unprotected the branch I was able to push fine

4
  • This is right answer. Gitlab has protected branch option, where you can't do force push.
    – chhantyal
    Commented Sep 10, 2014 at 13:36
  • 3
    Thanks, this is very useful... Any idea why a master branch would be set to protected on a new project (without explicitly setting it)?
    – Lucas
    Commented Nov 7, 2014 at 19:32
  • 1
    @Lucas: Gitlab wants you to review your code in another branch before merging in master. Source: about.gitlab.com/2014/11/26/keeping-your-code-protected
    – netAction
    Commented Sep 24, 2015 at 13:45
  • So if I understood right. The list of branches should be empty if anyone should push their commits? That means, if the list is empty I should not get this error right?
    – alexander
    Commented Sep 4, 2016 at 11:30
0

Kill it and start again with the Omnibus edition of Gitlab.

The only thing being that you need to run it on a 64-bit Ubuntu - not sure why they don't have a 32-bit, but there you are.

I had gone down the install-re-install-try-again hell until I just went with the Omnibus edition.

Two "annoying" things: the Omnibus install of Gitlab uses the Nginx web server rather than Apache (but there is a good reason for that given that Nginx doesn't open a new process for every connection)... and it uses PostgreSQL rather than MySQL for its database. For home/home-office usage, of course you can have PostgreSQL and MySQL installed on the same machine. Less obvious is how to run Apache and Nginx, or really, how to get Nginx to run multiple virtual servers while still maintaining Gitlab.

1
  • Thanks for helping me, unfortunately this didn't resolve my issue. I did a full reinstall, that seemed to do the trick.
    – AuStrike
    Commented Jun 5, 2014 at 14:11
0

I had a very similar symptoms, and solved the problem through a change to Project membership. The error message I received from TurtoiseGit after a push attempt was:

git.exe push --progress "origin" master:master

Counting objects: 14, done. Delta compression using up to 4 threads. Compressing objects: 100% (7/7), done. Writing objects: 100% (8/8), 857 bytes | 0 bytes/s, done. Total 8 (delta 3), reused 0 (delta 0)

remote: GitLab: You are not allowed to access master! remote: error: hook declined to update refs/heads/master

To [email protected]:datascience/compliance.git ! [remote rejected] master -> master (hook declined) error: failed to push some refs to '[email protected]:datascience/compliance.git'

git did not exit cleanly (exit code 1) (33181 ms @ 6/27/2014 9:50:32 AM)

In the gitlab admin pages, I found that I was not a member of the project that I tried to push to. I was a member of the project's group, but not the project.

After I added myself as a project member, my push succeeded without error.

0

in my case, it's because unicorn's port was occupied by another java process, add this line unicorn['port'] = 8090 to /etc/gitlab/gitlab.rb and run: sudo gitlab-ctl reconfigure

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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