I have powershell task configured in azure build pipelines to merge changes from dev into master of my github public repo and push changes to master. I am getting
fatal: could not read Username for 'https://github.com': terminal prompts disabled
Note:
- I have configured my gitconfig with my username and emailid.
- The git push is working fine when I do modifications in files and do commit and push but its throwing this error when i do merge and push
- I have sufficient privilege to push in the branch
Any help on this would be much appreciated. In case of more information needed, comment in this thread.
This is the actual snippet.
$branchName = $env:BRANCH_NAME;
Write-Host "Getting SHA for last commit in the latest release" -ForegroundColor Blue;
$latestReleaseCommitSHA = git rev-list --tags --max-count=1;
if([string]::IsNullOrEmpty($latestReleaseCommitSHA)) {
Write-Host "Unable to get the SHA for last commit in latest release" -ForegroundColor Red;
EXIT 1;
}
Write-Host "SHA for last commit in the latest release is '$($latestReleaseCommitSHA)'" -ForegroundColor Green;
Write-Host "Merging Changes till '$($latestReleaseCommitSHA)'" -ForegroundColor Blue;
git merge $latestReleaseCommitSHA
Write-Host "Checking Conflicted Files";
$conflictedFiles = git diff --name-only --diff-filter=U
if (-Not [string]::IsNullOrEmpty($conflictedFiles)) {
Write-Host "Unable to Merge" -ForegroundColor Red;
Write-Host "There are conflicts in below files:" -ForegroundColor Cyan;
Write-Host -Object $conflictedFiles -ForegroundColor Cyan;
EXIT 1;
}
Write-Host "Merged changes to '$($branchName)'" -ForegroundColor Green;
Write-Host "Pushing changes." -ForegroundColor Blue;
git push origin HEAD:$branchName
Write-Host "Pushed the changes to the $($branchName) branch." -ForegroundColor Green;