简体   繁体   English

本地Git Hook预提交/预推未运行(Windows)

[英]Local Git Hook Pre-Commit/Pre-Push does not run (Windows)

I have a repo set up which is supposed to run a fairly simple pre-push/pre-commit powershell script (It doesn't really matter when the script executes). 我有一个回购设置,应该可以运行一个相当简单的预推送/预提交的powershell脚本(脚本执行时并不重要)。 However, for the life of me I cannot get it to run. 但是,对于我的一生,我无法使其运转。 I have tried to use chmod +x .git/hooks/* and chmod ug+x .git/hooks/* I have tried editing the #!/bin/... and even removing it all together as I have read it is not supported in Windows. 我尝试使用chmod +x .git/hooks/*chmod ug+x .git/hooks/*我尝试编辑#!/bin/... ,甚至将其全部删除,因为我读过的是Windows不支持。 I know the script works because when I call it via & C:\\Users\\...\\.git\\hooks\\pre-commit.ps1 it works. 我知道该脚本有效,因为当我通过& C:\\Users\\...\\.git\\hooks\\pre-commit.ps1它时,它可以正常工作。

For what it's worth here is my script to be run: 值得在这里运行我的脚本:

#!/bin/bash
echo "Script Running"
& 'C:\Users\Ian Pennebaker\Desktop\RevisionDate.vbs'
Start-Sleep -s 30
& 'C:\Users\Ian Pennebaker\Desktop\MovePDF.vbs'
cd 'C:\Users\Ian Pennebaker\desktop\Test2'
pdftk *.pdf cat output ECMWC.pdf
& 'C:\Users\Ian Pennebaker\Desktop\DeleteAllButFinal.vbs'

It is currently named pre-push.ps1 but like I said earlier it could also be used at pre-commit or any other hook location. 它当前名为pre-push.ps1,但是就像我之前说的,它也可以在pre-commit或任何其他钩子位置使用。 Does anybody have any idea what is wrong here? 有人知道这里有什么问题吗?

将文件pre-commit.ps1重命名为pre-commit

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM