簡體   English   中英

Git post-commit hook:如何在 Windows 中啟動 bat 文件

[英]Git post-commit hook: How to start a bat-file in Windows

我有一個名為jenkins.bat的 bat 文件,可以在 jenkins 服務器上開始構建過程。

現在我想在 git 中將這個 bat 文件作為 post-commit-hook 執行。

因此,在文件夾/.git/hooks創建了以下文件post-commit

#!/bin/bash
/.git/hooks/jenkins.bat

但是每次向 git 提交代碼更改時,eclipse 都會拋出異常! 我錯過了什么嗎?

您需要使用絕對或相對路徑

  • 絕對:/c/...

  • 或者,正如評論的那樣,相對的,意思是不以/開頭

     ./jenkins.bat

假設您的提交后鈎子是可執行的,並且在您的jenkins.bat所在的<repo>/.git/hooks文件夾中。


正如保羅在評論中提到

這樣做./jenkins.bat工作時,該批處理文件是在鈎子目錄:你會得到一個“ no such file ”的錯誤。
這是因為鈎子的工作目錄

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM