gitlab git push時にエラー「pre-receive hook declined」発生時の対処法

gitlab git push時にエラー「pre-receive hook declined」発生時の対処法

gitlabを使用していてgit push時にエラー「pre-receive hook declined」が発生した場合の対処法を記述してます。

環境

  • gitlabサーバーOS 7.8.2003
  • クライアントOS windows10 pro
  • gitlab Community Edition 13.2.4

エラー全文

git push origin master時に発生

 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'http://url/group/sample.git'

原因

プロジェクトのmasterブランチに保護がかかっていたことが原因

対処法

保護を外してあげればpush可能になります。

設定をクリックします。

リポジトリをクリックします。

Protected Branchesの「Expand」をクリックします。

「Unprotect」をクリックします。

アラートが表示されるので「OK」ボタンをクリックします。

保護が解除されたので、これで「push」ができるようになりました。