I am new to Azure DevOps and learning and want to push a file from builds artifact directory to git repository. I am using this inline PowerShell script to do so:
Write-Host "Hello World"
write-host " Staging directory "$(build.artifactstagingdirectory)
git config --global user.email <useremail>
git config --global user.name <username>
git status
$CurrentPath = Get-Location
write-host "current path" $CurrentPath
$PackagePath =new-item -type directory $(get-date -f MM-dd-yyyy_HH_mm_ss)
$PackageZipPath = "$(build.artifactstagingdirectory)\<artifact to be copied>"
Copy-Item $PackageZipPath -Destination $PackagePath
git add .
git commit -m "Adding file"
git push origin master
git status
write-host "Package Uploaded to GitHub"
But I am getting this error and not able to push the file in repo:
fatal: could not read Password for 'https://<username>@dev.azure.com': terminal prompts disabled
Am I missing the obvious? How should I use PAT/Password to authenticate?