[英]Jira pre-receive hook on GitHub server not working for git commit pushes
我剛剛添加了https://github.com/github/platform-samples/blob/master/pre-receive-hooks/require-jira-issue.sh
腳本發送到我的github遠程存儲庫之一,並能夠在組織級別成功配置預接收鈎子,並為我的示例存儲庫之一啟用了它。 現在,當我從本地推送到該示例存儲庫時,始終會導致以下錯誤:-
remote: jira-commit-hook.sh: failed with exit status 1
remote: grep: Invalid range end
remote: ERROR
remote: ERROR: Your push was rejected because the commit
remote: ERROR: e9b0dd4695a51beb51e6fc1a8d16f01fa7dd13b8 in master
remote: ERROR: is missing the JIRA Issue
remote: ERROR:
remote: ERROR: Please fix the commit message and push again.
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://************'
我使用的提交正則表達式為msg_regex='[DST\\-[0-9]+\\]'
因為DST是我們jira中某個項目的項目密鑰。 我正在推送的所有提交在其消息中均包含字符串DST-***
,其中***
是數字,而DST-***
是此處jira項目的一些實際問題密鑰。 知道為什么遠程服務器掛鈎拒絕推送。 看起來它沒有驗證正則表達式。 知道為什么嗎?
-
在內部字符類[]
使用時,是正則表達式中的特殊字符,當它出現在除其他位置以外時,它表示范圍
[^]
所以你的正則表達式應該是
DST-[0-9]+
我的猜測基於您的原始表情,
[DST\-[0-9]+\]
是也許所需的表達是
\[DST-[0-9]+\]
或者只是
DST-[0-9]+
雖然不確定。 我很肯定您可能不需要轉義-
在這種情況下,因為它不在char類中,所以-
只是char類[]
一個metachar。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.