git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Windows Git pre-commit check file signature

From
RPRaymond Piller <ray@vertigion.com>
Date
Mar 25, 2014, 19:37 UTC
Message-ID
<CAJymQJz=Tu5cAJYUw3fxOyMkn4v-m_91NhcZ9BjjHz2CX9xnyg@mail.gmail.com>

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; this is technically TortoiseGit running this part.

**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?

I feel like this is a TortoiseGit issue, but wanted to bounce this on you all. I've submitted an issue: https://code.google.com/p/tortoisegit/issues/detail?id=2143

-- ~Ray ` ` ` ` ` ` ` ` ' ` ` ` ` ` ' ` ` ` ` ` ` ` Raymond A. S. Piller http://Vertigion.com 682-651-5653

Message 1 of 1 in “Windows Git pre-commit check file signature”
  1. Raymond PillerMar 25, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.