Azure DevOps Git Credential Issues

Published on Friday, December 13, 2019

Accessing multiple Azure DevOps Organizations from the same PC

I am not sure if this is a common problem. It was difficult to find forum posts or articles on the exact issue.

I use many Azure DevOps organizations on a daily basis, some are attached to the Microsoft corp. Azure AD tenant, a customer's tenant, or using my personal Microsoft Account (aka Live ID)

Even though I use the Git Credential Manager for Windows, it is common to get the following error when using a personal repo.

git pull
remote: TF401019: The Git repository with name or identifier Wyam-Blog does not exist or you do not have permissions for the operation you are attempting.
fatal: repository 'https://dev.azure.com/tylerd/Blog/_git/Wyam-Blog/' not found

Near as I can tell, a silent process in the background is authenticating to Azure DevOps using my corporate account (logged into my PC), acquiring a PAC (Personal Access Token), and storing the token in the Windows Credential vault. However, the problem is I don't want to use my corp credentials when accessing my personal projects.

If there is a better way to configure this, or git command to run, please leave a comment below, but for now I will fast-forward to a workaround.

Workaround

If you open the Windows Credential Manager after attempting to access the repo, you will notice that the Git Credential Manager has added a "Generic Credential" to access Azure DevOps

Windows Credential Manager

Get new PAC

  • Login to the Azure DevOps project you are trying to access.
  • Under your user settings, open the Personal access tokens screen

Open Personal Access Token Screen

  • Create a new token
  • Set the permissions, for the Git CLI you mainly need Code: Read & write
  • Copy the new token value
  • On you PC, open Control Panel > Credential Manager
  • Switch to Windows Credentials
  • Under Generic Credentials, find the Azure DevOps organization credential that was created. In my case that was "git:https://tylerd@dev.azure.com/tylerd"
  • Click Edit

Edit Credential

  • Replace the Password with your new Personal Access Token
  • Click Save
  • All done!

Try running the Git command again and you should have access to your repo.

Comments


?