You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Check if Git is installed and retrieve the current version
$gitPath = (Get-Command git -ErrorAction SilentlyContinue).Path
if (-not $gitPath) {
Write-Output "Git is not installed on this system."
exit
}
# Get the current Git version
$gitVersionOutput = git --version
$gitVersion = $gitVersionOutput -replace '[^\d\.]', '' # Strip non-numeric characters
$versionArray = $gitVersion.Split('.').ForEach{[int]$_} # Convert version to array of integers
# Define the Git update command based on version
if ($versionArray[0] -gt 2 -or ($versionArray[0] -eq 2 -and $versionArray[1] -gt 16) -or ($versionArray[0] -eq 2 -and $versionArray[1] -eq 16 -and $versionArray[2] -ge 1)) {
# Git version is 2.16.1 or greater
Write-Output "Git version is 2.16.1 or newer. Using 'git update-git-for-windows' command."
& git update-git-for-windows -y /VERYSILENT
}
else {
# Git version is 2.16.0 or earlier, and no update will be attempted
Write-Output "Git version is 2.16.0 or earlier, which cannot be updated automatically with this script."
}
Write-Output "Git update process completed."
What did you expect to occur after running these commands?
Ok, so not an issue with more of a requested feature?
Long story short, we have hundreds of devices with Gt installed like this and we need a way to update them all silently. It would be nice if this works and no popups for the end users and I can deploy this script once a week or so just to check that devices are up to date.
What actually happened instead?
The end users get a popup box saying Git is installing and I know for a fact some will just close/cancel this and not let Git update.
If the problem was occurring with a specific repository, can you provide the
URL to that repository to help us with testing?
So I am only testing with an old version if I test with the latest version it won't try to update as it is the latest version.
The text was updated successfully, but these errors were encountered:
But maybe it is the uninstall progress bar (Git for Windows' installer will uninstall any previous version it found before installing the current version, to ensure that there are no left-over files)? But no, the uninstaller is called with /VERYSILENT.
The uninstaller is actually called with more options: /VERYSILENT /SILENT /NORESTART /SUPPRESSMSGBOXES. Maybe the progress you see is suppressed when running the installer with all of those options?
Hmm. But now I see a problem:
& git update-git-for-windows -y /VERYSILENT
This assumes that update-git-for-windows supports a /VERYSILENT option, but it does not! It always starts the installed with /SILENT /NORESTART, and that's it.
Setup
defaults?
to the issue you're seeing?
Install location: %USERPROFILE%\AppData\Local\Programs\Git\
Details
PowerShell 7
Minimal, Complete, and Verifiable example
this will help us understand the issue.
Ok, so not an issue with more of a requested feature?
Long story short, we have hundreds of devices with Gt installed like this and we need a way to update them all silently. It would be nice if this works and no popups for the end users and I can deploy this script once a week or so just to check that devices are up to date.
The end users get a popup box saying Git is installing and I know for a fact some will just close/cancel this and not let Git update.
URL to that repository to help us with testing?
So I am only testing with an old version if I test with the latest version it won't try to update as it is the latest version.
The text was updated successfully, but these errors were encountered: