"pullRequestRefGuardHook vetoed the push request" message seen in Bitbucket Server logs
プラットフォームについて: Data Center - この記事は、Data Center プラットフォームのアトラシアン製品に適用されます。
このナレッジベース記事は製品の Data Center バージョン用に作成されています。Data Center 固有ではない機能の Data Center ナレッジベースは、製品のサーバー バージョンでも動作する可能性はありますが、テストは行われていません。サーバー*製品のサポートは 2024 年 2 月 15 日に終了しました。サーバー製品を利用している場合は、アトラシアンのサーバー製品のサポート終了のお知らせページにて移行オプションをご確認ください。
*Fisheye および Crucible は除く
要約
A repository repo1.git
is mirrored onto another repository repo2.git
. Git push operation fails with 'pre-receive hook declined
' message on the client side. On the server side, "'pullRequestRefGuardHook' vetoed the push request"
message is seen in the logs.
環境
Bitbucket 8.9.3
診断
A repository repo1.git
is mirrored onto another repository repo2.git
. The operation is done by running the command "git clone --mirror <clone_url_for_repo1.git>"
and pushed using the command "git push --mirror <remote_url_repo2.git>"
.
On the Git client side, we see the below message:
! [remote rejected] branch1 -> branch1 (pre-receive hook declined)
! [remote rejected] branch2 -> branch2 (pre-receive hook declined)
On the Bitbucket server side, in atlassian-bitbucket.log
, we see the below message:
<DATE-TIMESTAMP> INFO [mesh-grpc-request:thread-2524] XXXXXXXXXXXX \*1XXXXXXx730x4106118x1 1htkkkz XX.XX.XX.XX SSH - git-receive-pack '/proj/repo2.git' c.a.s.i.h.r.DefaultRepositoryHookService [proj/repo2[12]] hook 'pullRequestRefGuardHook' vetoed the push request
原因
'pullRequestRefGuardHook'
is a system-level hook that prevents create/update/delete operations for refs that are reserved for Pull requests. The internal Bitbucket refs on the repository repo2.git
are being altered due to --mirror
option that is declined through the system hook 'pullRequestRefGuardHook
'.
The issue is that when the repository was cloned from the source, the clone fetched the pull request references as well. When a push to the remote is done in the destination, the rewritten PR references are pushed as well, which Bitbucket does not allow.
ソリューション
Follow the steps documented in the KB: Getting "pre-receive hook declined" error while trying to move repository from one project to another in Bitbucket Server.