After asking on the GCM Github issues page it turns out that the GCM does not support reading credentials from a file.
But my goal is to allow non-interactive population of credentials and it does support programmatically adding credentials to the Windows Credential Store that GCM uses under the hood. By using the bundled libraries (binaries here) I was able to put together a Powershell script that allowed us to add credentials during machine provisioning by Chef :
Add-Type -Path 'c:\path\to\gcm-v1.4.0\Microsoft.Alm.Authentication.dll'
$credentials = New-Object -TypeName Microsoft.Alm.Authentication.Credential('someuser', 'secret')
$targetUri = New-Object -TypeName Microsoft.Alm.Authentication.TargetUri('https://git.example.com/projects')
$namespace = "git"
$secretStore = New-Object -TypeName Microsoft.Alm.Authentication.SecretStore($namespace, $null, $null, $null)
$foundCredentials = $null
$secretStore.ReadCredentials($targetUri, [ref] $foundCredentials)
if ($foundCredentials -ne $null) {
echo "Credentials already found, not inserting"
} else {
echo "Inserting stored credentials"
$secretStore.WriteCredentials($targetUri, $credentials)
}
This allows the Jenkins slave to perform Git clones without user interaction.
Note: You will need to run the Powershell script with the "Unrestricted" execution policy as well as unblock the DLLs included in the GCM otherwise they won't load.