Windows Git预提交检查文件签名

时间:2014-03-24 22:21:45

标签: git tortoisegit

我尝试在允许提交文件之前确保正确签名特定文件。我使用PowerShell来做到这一点,但这不是一个PowerShell问题。这是我用来检查的命令:

/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -Command "If ((Get-AuthenticodeSignature .\test.ps1).Status -ne 'Valid') { Exit 1 }"

注意:我已尝试使用以下powershell开关的变体:

-NoLogo -NonInteractive -NoProfile

首先,似乎是退出代码丢失并始终为0.经过进一步调查后,似乎该命令甚至无法运行。例如,这是一个测试命令:

/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -Command "Get-Location | Out-File C:\Temp\test.txt"

从GitBash shell执行时,此 test 命令运行正常; test.txt文件已创建。在预提交钩子文件中,它无法创建test.txt文件;这是技术上运行此部分的TortoiseGit。

问题:在Windows上,在允许提交文件之前,如何确保特定文件已正确签名?有没有办法让gpg命令使用Windows证书库来验证签名?

我觉得这是一个TortoiseGit问题,但是想把它反弹给大家。我提交了一个问题: https://tortoisegit.org/issue/2143

0 个答案:

没有答案