When upgrading the git package, it installs successfully even if GPG commit signing had previously been in use.
If GPG commit signing had been in use (such that gpg-agent.exe is running at the time of the choco upgrade or cup command), the git installer will be unable to upgrade it, and the git (and git.install) upgrade will fail.
taskkill /im gpg-agent.exe /f prior to starting the git upgrade
gpg-agent.exe task)choco upgrade gitUnless I've restarted Windows since the last time I signed a commit, the git upgrade via Chocolatey always fails.
It could be argued thaat this is upstream problem. Native installer should do so.
Can't say that I have seen this error myself, as the git installer kills the gpg-agent.exe whenever I upgrade git through chocolatey.
I assume we could implement some way to stop the process during upgrade/uninstalls though just to be safe.
I will look into it as soon as I can do that, or if someone is interested feel free to open a PR for it instead.
Maybe it can't kill it on specific machine due to rights.
Maybe. But there should be no harm as far as I can see to add stopping the process in a chocolateyBeforeModify.ps1 script anyways.
The code necessary to resolve this has been added to the install package, and will be available for any future versions of the git/git.install package.
@AdmiringWorm this looks not to have made it into the git 2.26.1 release from a few days ago? At any rate, a cup all with git and git.install 2.26.0 installed (which should have upgraded to 2.26.1) failed, with
Installing 64-bit git.install...
ERROR: Running ["C:\ProgramData\chocolatey\lib\git.install\tools\Git-2.26.1-64-bit.exe" /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /NOCANCEL /SP- /LOG /COMPONENTS="icons,assoc,assoc_sh,ext,ext\shellhere,ext\guihere,gitlfs,icons\quicklaunch" ] was not successful. Exit code was '1'. See log for possible error messages.
The upgrade of git.install was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\git.install\tools\chocolateyInstall.ps1'.
See log for details.
I grabbed the first Get-Process ... and Stop-Process ... (without -Force) PowerShell commands from https://github.com/chocolatey-community/chocolatey-coreteampackages/commit/7dd16c258d78ac09d4cf45dc50bc6c4d18c8ad35 and ran them, to verify that they stopped the gpg-agent process, then was able to do a choco install git -y --force (forcing because the upgrade had failed but it still thought it was installed), and that worked.
Maybe this wasn't expected to have made it into the 2.26.1 release but I thought I should note it here just in case it was.
@medianick I guess I should have been a little clearer in my last comment.
It did make it into the 2.26.1 release, however, as I had already mentioned it was added to the chocolateyBeforeModify.ps1 script.
This script is run from the already installed package version, not from the package version you are upgrading to.
So in the end, the code was added, but won't be run until a version after the package version the code was added to have been installed.
Got it, thank you for the clarification!
The same error happened with the upgrade from 2.26.1 to 2.26.2; I had to taskkill gpg-agent.exe once again, then install git with --force to fix the installation. Is there a place I can locally confirm whether this corrected script is already in place, for the next upgrade after 2.26.2?
@medianick the file should be located at %ChocolateyInstall%\lib\git.install\tools and be called chocolateyBeforeModify.ps1. This file should run before upgrading and before uninstalling a package.
During your upgrade, you should also have gotten at least one warning mentioning it will try to stop the GPG Agent.
If you didn't, then it would mean that the script wasn't finding any process matching gpg-agent*.
@AdmiringWorm indeed the expected .ps1 file is in that location, so I'm not sure what the problem could be. I just signed a new commit (which launched the expected gpg-agent process) and have verified in an elevated PowerShell that running the chocolateyBeforeModify.ps1 file there does indeed output the expected warning messages (and stops the process), and rerunning it (with the process now stopped) does not output anything, again as expected.
I can wait until the next git upgrade to try once more, and will capture the output then.