Categories
Computers and Internet

Username for ‘https://dev.azure.com’

This is another quick aide-memoire for myself around git authentication with Azure DevOps.

Now and again when attempting to run “git pull” from the command line, I will receive the following prompt:

> Username for https://dev.azure.com

This happens on a machine managed by a corporation. Applications are automatically installed and updated using Software Center. It seems that when git is updated by the corporation, it is wiping out the credential.helper setting in git, and so git is not trying to use the Git Credential Manager. The Azure DevOps normal Oath2 authentication required Git Credential Manager.

Solution

Two ways to solve this:

  1. Reinstall git, unchecking the “only show new options” and make sure to select the Git Credentials Manager option when you get to that page.
  2. git config --global credential.helper manager

The former solution sets the credential.helper in the git config held in the Program Files folder (on Windows). The latter sets it in the git config in the user profile (C:/Users/xxxx/.gitconfig), which should survive any attempt to reset the value by the installation from Software Center.

There is a third way to solve this, which is to use a Personal Access Token (PAT) for Azure DevOps. Once set up, your Azure DevOps login email and the PAT can be used as a simple username and password at the prompt. I’d recommend against this as you’re avoiding two factor authentication and providing a (limited) back door into performing operations on your account.