Azure-pipelines-agent: fatal: could not read Username for 'https://github.com': terminal prompts disabled

Created on 8 Apr 2019  路  3Comments  路  Source: microsoft/azure-pipelines-agent

I am not sure where this error should be posted, direct me to the right place if this is not the one.

Org: https://o365exchange.visualstudio.com

What's not working?

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

Here is my powershell script:

$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;
question

Most helpful comment

@TingluoHuang I have fixed this by using pushing my code with
git push https:// [email protected]/username/reponame.git

Thank you!

All 3 comments

@muthurathinam how did you setup your credential in your git config? you can also debug git with setting environment variable GIT_CURL_VERBOSE.

@TingluoHuang I have fixed this by using pushing my code with
git push https:// [email protected]/username/reponame.git

Thank you!

How can i push only using uname and passwd . I dont want to use PAT ? Let me know .

Was this page helpful?
0 / 5 - 0 ratings