I think, it's a different issue than this(remote rejected master -> master (pre-receive hook declined)), and many people are facing same issue, So I am posting a new here.
My friend added me on bitbucket.org as admin, so that I can help on his project. So, I wanted to start by taking a pull of latest code on my local.
Steps I followed:
- Goto empty folder
git init
git remote -v
(this gives nothing)git remote add origin <path to git repo>
git remote add master <path to git repo>
git remote -v
(this show both with fetch and push in brackets)git fetch origin master
git pull origin master
(I have latest code now, all files and folders)touch test
(lets test a "test" commit)git status
git add .
git commit -m "testing, first commit"
git push origin master
error:
Counting objects: 4, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 274 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: permission denied to update branch master
To '<repo path>'
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '<repo path>'
What worked for me was:
I think package setuptools/distribute is listed in requirements.txt. Please remove the same.
It looks like the branch management (one of the admin settings) in bitbucket has been configured to only allow certain people to push directly to master.
Try creating a branch -
git checkout -b test
, create your test commit and pushgit push origin test:test
. You can always cleanly delete this branch once you have completed the test.The other option (probably best agreeing with whoever set this up) is you go to
bitbucket
and head to admin, branch management and removemaster
be to limited. cf - https://confluence.atlassian.com/display/BITBUCKET/Branch+managementI have better solution on Bitbucket: If you are admin go to Repo >Settings >Limit Pushes section, and in "Branch name" put 'master', and in "..search... user" put your user name - then push "ADD" - and you are done :)
Just reporting another case leading to the specified error. If the Bitbucket repository size reaches 2 GB, Bitbucket itself restricts the repository to read-only access. When that happens, contributors with read/write permissions are not able to push and get the "pre-receive hook declined" error.
I also found these documents from Atlassian: https://blog.bitbucket.org/2014/05/30/repository-size-limits/ https://confluence.atlassian.com/bitbucket/reduce-repository-size-321848262.html
Links include a guide on how to restore the repo back to full functionality
The same issue with me on gitlab, I asked the repo owner to grand me
maintainer
role and the issue fixed.