Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Logon failed, use ctrl+c to cancel basic credential prompt to Git in Azure DevOps

People also ask

How do I get rid of basic credential prompt?

authentication - Logon failed, use Ctrl + C to cancel basic credential prompt - Stack Overflow. Stack Overflow for Teams – Start collaborating and sharing organizational knowledge.

How do I stop Git from asking for credentials?

You can avoid being prompted for your password by configuring Git to cache your credentials for you. Once you've configured credential caching, Git automatically uses your cached personal access token when you pull or push a repository using HTTPS.

How do I get Git credentials from Azure DevOps?

The Git Credential Manager is an optional tool that makes it easy to create PATs when you're working with Azure Repos. Sign in to the web portal, generate a token, and then use the token as your password when you're connecting to Azure Repos. PATs are generated on demand when you have the credential manager installed.


It happens if the git is not updated to the latest version.

Please update the git and you are good to go.

To update the git, just follow the below command depending on the type of OS you are using:

windows: git update-git-for-windows

Linux/Unix: git update

or follow the below link to get the latest copy of the git client for your OS

https://git-scm.com/downloads


You just need to update your git. open terminal and type IN WINDOWS

git update-git-for-windows

IN OTHER

git update


It looks like in this case you actually have two sets of credentials that are in use, and Git has tried one and failed, and fallen back to the other one. This prompt comes up when the credential manager is invoked on Windows in case a prompt is displayed and you need to enter some credentials.

When you put a PAT in the URL like in this case, you need to put the PAT as the password. That means you need to specify a username, so your URL should start with something like https://username:[email protected]/. It isn't clear from your post whether you have the username: portion, so if you don't be sure to add one (it can be anything in this case; token and your username are common).

If you don't have a URL of that form, your PAT isn't being used, and you're likely falling back to whatever is in your credential manager, which is correct. Otherwise, it's possible that Git is preferring something in your credential manager which isn't correct, and falling back to something that is. Either way, you should inspect the credentials in Windows Credential Manager and delete any that are incorrect.


I think that the problem is that you did not allowed your Agent job to acces the Auth token. Try to check this option for the agent job: enter image description here


Git http.extraheader & bearer

Manual 's answer helped put me on the right track.

YAML style Pipelines can use the preset variable System.AccessToken. After examining the formal 'Checkout ...' step at the beginning of the Pipeline I found this step to work in my script:

- task: PowerShell@2
  inputs:
    targetType: 'inline'
    script: 'git -c http.extraheader="AUTHORIZATION: bearer $(System.AccessToken)" clone --depth 1 https://[email protected]/my-org/my-proj/_git/my-repo'

Note that Azure DevOps job authorization scope may affect this