lundi 24 mars 2014

Windows Git pre-commit check file signature


Vote count:

0




I'm trying to ensure that a specific file is signed properly before allowing the file to be commited. I'm using powershell to do this, but this isn't a powershell issue. Here's the command I'm using to do the check:



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


Note: I've tried with variation of the following powershell switches:



-NoLogo -NonInteractive -NoProfile


At first, the appeared to be that the exit code is lost and is always 0. After further investigation, it appears that this command doesn't even run. For example, here's a test command:



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


This test command runs fine when executed from the GitBash shell; the test.txt file is created. When in the pre-commit hook file, it fails to create the test.txt file.


Question: On windows, how do I ensure that a specific file is signed properly before allowing the file to be commited? Is there a way to have the gpg command use the windows cert store for validation of a signature?



asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire