Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

pre-receive hook declined Windows 11

Sofía Correa Busquets
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 13, 2023

Hello,

I am running a Windows 11 laptop that has had no problem with Bitbucket for 7 months. I frequently push to the master branch of a repo that I own, for which I have Admin access. I began to get the following error:

 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to [MY_REPO_URL]

It does not resemble other issues on this error here solved because...

  • It does not involve XenServer
  • The same error appears when I try to push the smallest commit possible (not exceeding buffer size)

I have tried the following to debug:

  • Check global git config in case my user logged off --> credentials correct
  • git stash, git reset, git fetch, git pull --> same error for push
  • Delete pre-receive hook for repo --> no webhooks listed in repo settings
  • Clone repo again and attempt new push --> same error
  • Disconnect all antivirus settings on device --> same error for push
  • Allow commit history rewrite on repo --> same error for push
  • Try a push to another repo on the same workspace --> same error

As precedent...

  • ESET Endpoint Security was installed on my device a week before this happened and I had been able to push correctly since.
  • Right before I started getting this push error, my device seemed to "forget" python's location. I was running a .ipynb on VSCode, closed it, reopened it 20 minutes later and VSCode claimed I did not have Python installed on my computer.
    • Python still seemed to be in PATH, since python commands worked with cmd from any location.
    • I ran a simple .py file for test but had to manually set the location for python.exe, after which the file ran perfectly.
    • VSCode still could not find a Python interpreter, but it had solved when I re-opened VSCode after the weekend.

Could anybody help me get across the pre-receive hooks for the workspace I use? Big thanks in advance!

2 answers

1 accepted

0 votes
Answer accepted
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 14, 2023

Hello @Sofía Correa Busquets ,

Welcome to Atlassian Community!

The pre-receive-hook declined error is usually returned when you have some branch restrictions set up in your repository, and the commit you are trying to push does not meet the requirements of that branch restriction.

For example, a user can have a branch restriction that does not allow direct pushing to the master branch, only allowing merging to that branch through Pull Request.

With that in mind, I would suggest checking if there are any branch restrictions in that particular repo (Repository Settings > Branch restrictions) and if they do exist, try to temporarily remove them to see if you are able to push.

Let me know in case you have any questions.

Thank you, @Sofía Correa Busquets !

Patrik S

Sofía Correa Busquets
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 15, 2023

Thanks Patrik! Even though I have Admin access to this repo, changing from "Admins can write" to "Specific users can write" and adding my own account, worked. I can now also push to other repos without having changed any settings on them 🙌

Like Patrik S likes this
Deleted user December 21, 2023

Hey Sofía Correa Busquets,

 

I am getting this same issue when i am pushed code into Github.

 

Can you please help me out which setting I have to change inside  (Repository Settings > Branch restrictions) .

Thanks :)

0 votes
qasem alodat
Banned
July 4, 2024

it may be from onedrive we can link

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events