I'm trying to do a checkout using git from a powershell script using Azure Pipelines (yaml).
When I run the following during my build, my build hangs..
- task: PowerShell@2
# ------------------------------------------------------
displayName: Update readme.txt
# ------------------------------------------------------
inputs:
targetType: filePath
filePath: '$(System.DefaultWorkingDirectory)\${{ parameters.devOpsArtifactName }}\update-changelog.ps1'
workingDirectory: '$(System.DefaultWorkingDirectory)\${{ parameters.devOpsArtifactName }}'
arguments: '-WorkingDirectory "$(System.DefaultWorkingDirectory)" -Version "$(buildNumber)" -BranchesToPush "develop" -GitRequestedForEmail "$(Build.QueuedById)" -GitRequestedFor "$(Build.QueuedBy)" -UpdateRepo'
env:
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
function Checkout([String]$branch, [String]$gitRequestedForEmail, [String]$gitRequestedFor)
{
Write-Host "Checking out $branch for $gitRequestedFor ($gitRequestedForEmail)."
git config --global credential.modalPrompt false
git config --global user.email $gitRequestedForEmail
git config --global user.name $gitRequestedFor
git fetch
git checkout $branch
}
EDIT
Supressing the modal (as suggested) doesn't work, preferably I want to use SYSTEM_ACCESSTOKEN to authenticate.
git config --global credential.modalPrompt falseset GIT_TERMINAL_PROMPT=0fetchcommand:git fetch https://username:[email protected]/my/repository