Tag Archives: ! [remote rejected] master -> master (pre-receive hook declined)

[Solved] Git push Error: ! [remote rejected] master -> master (pre-receive hook declined)

Git push solution:[ remote rejected] master -> master (pre-receive hook declined)

The day before yesterday, I was going to back out a version and push it to the remote branch, but I tried many times and couldn’t upload it. The error is as follows:

! [ remote rejected] master -> master (pre-receive hook declined)

Screenshot:

1. Turn off the protected permission of the branch where the content to be pushed is located

(1) Enter the settings of your project

(2) Click protected branches and unprotected to change the authority of the master branch, that is, to turn off the protected authority of the master

2. Create a new branch, push the project to the new branch, and merge later

(1) New branch

git branch name

(2) Switch branches

git checkout name

(3) Upload project

git add .

git commit -m "commit message"

git remote add origin remote repository address git push -u origin branch name