Azure DevOps - Git unauthorized after moved to other tenant
I worked on a git repository hosted in Azure DevOps. Everything worked fine, until the DevOps was moved to another tenant.
Now my git repository was broken (Authentication failed
).
I deleted the whole local repository and tried to get it again.
But every time I tried to clone it, git opened the wrong tenant login view (the old one). Instead of showing the login view for the new tenant.
Here is the log produced by the git clone
command.
PS C:\Temp> git clone --recurse-submodules https://CUSTOMER@dev.azure.com/CUSTOMER/PROJECTNAME/_git/REPOSITORYNAME
12:54:57.548715 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
12:54:57.549714 git.c:444 trace: built-in: git clone --recurse-submodules https://CUSTOMER@dev.azure.com/CUSTOMER/PROJECTNAME/_git/REPOSITORYNAME
Cloning into 'REPOSITORYNAME'...
12:54:57.564726 run-command.c:663 trace: run_command: git remote-https origin https://CUSTOMER@dev.azure.com/CUSTOMER/PROJECTNAME/_git/REPOSITORYNAME
12:54:57.573735 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
12:54:57.574735 git.c:704 trace: exec: git-remote-https origin https://CUSTOMER@dev.azure.com/CUSTOMER/PROJECTNAME/_git/REPOSITORYNAME
12:54:57.574735 run-command.c:663 trace: run_command: git-remote-https origin https://CUSTOMER@dev.azure.com/CUSTOMER/PROJECTNAME/_git/REPOSITORYNAME
12:54:57.586245 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
12:54:57.713691 run-command.c:663 trace: run_command: 'git credential-manager get'
12:54:57.747220 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
12:54:57.748222 git.c:704 trace: exec: git-credential-manager get
12:54:57.748222 run-command.c:663 trace: run_command: git-credential-manager get
12:54:57.800265 ...\Common.cs:744 trace: [Main] git-credential-manager (v1.20.0) 'get'
12:54:57.844803 ...\Git\Where.cs:348 trace: [FindGitInstallations] found 1 Git installation(s).
12:54:57.848307 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 12 entries.
12:54:57.894846 ...\Common.cs:85 trace: [CreateAuthentication] detecting authority type for 'https://CUSTOMER@dev.azure.com/'.
12:54:58.024191 ...uthentication.cs:223 trace: [DetectAuthority] detected 'https://dev.azure.com/CUSTOMER/' as Azure DevOps from GET response.
12:54:58.028695 ...uthentication.cs:291 trace: [DetectAuthority] tenant resource for 'https://dev.azure.com/CUSTOMER/' is {TENANTID}.
12:54:58.029195 ...uthentication.cs:359 trace: [GetAuthentication] AAD authority for tenant 'TENANTID' detected.
12:54:58.059221 ...\Common.cs:140 trace: [CreateAuthentication] authority for 'https://CUSTOMER@dev.azure.com/' is Azure Directory.
12:54:58.059221 ...\Common.cs:765 trace: [QueryCredentials] querying 'AzureDirectory' for credentials.
12:54:58.064225 ...uthentication.cs:384 trace: [GetCredentials] credentials for 'https://CUSTOMER@dev.azure.com/' found.
12:54:58.425183 ...\Common.cs:817 trace: [QueryCredentials] credentials for 'https://CUSTOMER@dev.azure.com/' found.
12:54:58.425682 ...\Common.cs:709 trace: [LogEvent] Azure Directory credentials for 'https://CUSTOMER@dev.azure.com/' successfully retrieved.
12:54:58.685692 run-command.c:663 trace: run_command: 'git credential-manager erase'
12:54:58.714217 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
12:54:58.715218 git.c:704 trace: exec: git-credential-manager erase
12:54:58.715218 run-command.c:663 trace: run_command: git-credential-manager erase
12:54:58.763760 ...\Common.cs:744 trace: [Main] git-credential-manager (v1.20.0) 'erase'
12:54:58.807796 ...\Git\Where.cs:348 trace: [FindGitInstallations] found 1 Git installation(s).
12:54:58.811800 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 12 entries.
12:54:58.848831 ...\Common.cs:85 trace: [CreateAuthentication] detecting authority type for 'https://PersonalAccessToken@dev.azure.com/'.
12:54:58.861843 ...uthentication.cs:199 trace: [DetectAuthority] 'https://dev.azure.com/CUSTOMER/' is Azure DevOps, tenant resource is {TENANTID}.
12:54:58.863844 ...uthentication.cs:359 trace: [GetAuthentication] AAD authority for tenant 'TENANTID' detected.
12:54:58.895372 ...\Common.cs:140 trace: [CreateAuthentication] authority for 'https://PersonalAccessToken@dev.azure.com/' is Azure Directory.
12:54:58.896373 ...\Common.cs:259 trace: [DeleteCredentials] deleting Azure DevOps credentials for 'https://PersonalAccessToken@dev.azure.com/'.
12:54:58.900876 ...aseSecureStore.cs:59 trace: [Delete] credentials not found for 'git:https://PersonalAccessToken@dev.azure.com/CUSTOMER'.
12:54:58.917890 run-command.c:663 trace: run_command: 'git credential-manager erase'
12:54:58.947918 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
12:54:58.949418 git.c:704 trace: exec: git-credential-manager erase
12:54:58.949418 run-command.c:663 trace: run_command: git-credential-manager erase
12:54:58.998460 ...\Common.cs:744 trace: [Main] git-credential-manager (v1.20.0) 'erase'
12:54:59.042498 ...\Git\Where.cs:348 trace: [FindGitInstallations] found 1 Git installation(s).
12:54:59.046501 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 12 entries.
12:54:59.082534 ...\Common.cs:85 trace: [CreateAuthentication] detecting authority type for 'https://PersonalAccessToken@dev.azure.com/'.
12:54:59.221201 ...uthentication.cs:223 trace: [DetectAuthority] detected 'https://dev.azure.com/CUSTOMER/' as Azure DevOps from GET response.
12:54:59.226706 ...uthentication.cs:291 trace: [DetectAuthority] tenant resource for 'https://dev.azure.com/CUSTOMER/' is {TENANTID}.
12:54:59.227707 ...uthentication.cs:359 trace: [GetAuthentication] AAD authority for tenant 'TENANTID' detected.
12:54:59.258733 ...\Common.cs:140 trace: [CreateAuthentication] authority for 'https://PersonalAccessToken@dev.azure.com/' is Azure Directory.
12:54:59.259735 ...\Common.cs:259 trace: [DeleteCredentials] deleting Azure DevOps credentials for 'https://PersonalAccessToken@dev.azure.com/'.
12:54:59.265240 ...aseSecureStore.cs:59 trace: [Delete] credentials not found for 'git:https://PersonalAccessToken@dev.azure.com/CUSTOMER'.
fatal: Authentication failed for 'https://dev.azure.com/CUSTOMER/PROJECTNAME/_git/REPOSITORYNAME/'
I tried to delete the Cache, erase the CredentialManager from git, logout in VisualStudio and so on...but nothing worked.
Solution
The solution was to delete the Credentials for this DevOps from the Windows Credential Manager
. Then I cloned the project again and the correct tenant login view appeared.