Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Copy Root Certs to Windows Git Cert File
$Path = ($env:ProgramFiles + "\Git\mingw64\ssl\certs\ca-bundle.crt")
# Make a backup
Copy-Item $Path ($Path + ".old") -Force
$certs = Get-Childitem cert:\LocalMachine\root -Recurse
foreach ($cert in $certs) {
Add-Content $Path "-----BEGIN CERTIFICATE-----"
Add-Content $Path -Value ([convert]::tobase64string((get-item $cert.PSPath).RawData)) -Encoding Ascii
Add-Content $Path "-----END CERTIFICATE-----"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment