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

GitAzure Devops

Git Problem Overview


When cloning a git repository sitting up in Azure Repos into my local machine clone succeeds but I get a line that says:

Logon failed, use ctrl+c to cancel basic credential prompt 

Not sure what this is referring to, any ideas?

I'm using PAT token to authenticate my clone, command is:

git clone https://*************PAT*************@dev.azure.com/orgname/projectname/_git/reponame

Git Solutions


Solution 1 - Git

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

Solution 2 - Git

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

> git update-git-for-windows

IN OTHER

> git update

Solution 3 - Git

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.

Solution 4 - Git

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

Solution 5 - Git

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

Solution 6 - Git

Our company has 2 domains that we access DevOps:

https://vso[companyname].visualstudio.com

and

https://dev.azure.com/vso[companyname]

In the repos .gitsubmodule file I changed the URL from one to the other, and the build magically started working.

Solution 7 - Git

I've encountered a similar issue when using git repos on my local machine which are cloned from an Azure DevOps repository.

The initial clone works, I can pull/push without issue until I have to re-authenticate with azuread/adfs as the session eventually expires. Git will correctly prompt with the azure login page, and I can successfully authenticate against our tenancy, but Git will error with the basic credential prompt and "Logon failed, use ctrl+c to cancel basic credential prompt" appearing.

The only way I have found to get around this is to login to Azure DevOps via the browser (where my session will have also expired), then do the authentication with git again, which somehow allows it to work.

Solution 8 - Git

Just need to create the credentials from the azure. click on clone->click git credentials-> it will create the user name and password . use this password in jenkins job. It will work

Solution 9 - Git

If you are using github repositories, you might need to check that you have not removed the rights of Azure Pipelines in your github Applications settings:

  • In your github profile settings, Applications, Azure Pipelines, Configure
  • Then in Repository Access, check that all repositories with pipelines are selected.

Solution 10 - Git

You can try 3 things to resolve this issue

  1. try with Administrator mode of visual studio.
  2. download latest git credentials manager
  3. add //.vs//DesignTimeBuild/.dtbcache.v2 to git ignore

Solution 11 - Git

If you are still getting this error for BitBucket & Visual Studio 2019 then please use app password instead of your regular BitBucket login password as of Mar 1 2022 BitBucket stopped using regular password for API based authentication. See reference

https://community.atlassian.com/t5/Bitbucket-articles/Announcement-Bitbucket-Cloud-account-password-usage-for-Git-over/ba-p/1948231

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser11306993View Question on Stackoverflow
Solution 1 - GitJasneet DuaView Answer on Stackoverflow
Solution 2 - GitZiaView Answer on Stackoverflow
Solution 3 - Gitbk2204View Answer on Stackoverflow
Solution 4 - GitManuel RoldanView Answer on Stackoverflow
Solution 5 - GitPeter LView Answer on Stackoverflow
Solution 6 - GitwavydavyView Answer on Stackoverflow
Solution 7 - GitMarshall CalanteView Answer on Stackoverflow
Solution 8 - GitRishabh KumarView Answer on Stackoverflow
Solution 9 - Gitded'View Answer on Stackoverflow
Solution 10 - GitAnkitSarafView Answer on Stackoverflow
Solution 11 - GitCurious DeveloperView Answer on Stackoverflow