67625
## 概要

期待する動作  
Git LFSを有効にしたリポジトリがAzure DevOpsのReposにpushできる

現状  
Azure DevOpsのReposにGit LFSを有効にしたリポジトリをpushしようとしたときだけ失敗する

## 詳細

Git LFSを有効にしたリポジトリをpushしようとするとGCM for Windowsでユーザ認証を要求するポップアップが表示されます  
リストに並ぶVisual Studio
のサブスクリプションが有効なアカウントを選択すると一旦ウィンドウは閉じますが、再度同じウィンドウがポップアップされます  
表示されたウィンドウを閉じる操作を繰り返すと、Visual Studioの出力ウィンドウに以下のメッセージが出力され、Pushが正常にできない状態になります  
※ユーザ名、組織名、プロジェクト名は伏せてあります

```

    C:\Users\{UserName}\source\repos\TestForDM
    master をプッシュしています
    Pushing to https://dev.azure.com/{OrgName}/{ProjectName}/_git/TestForDM
    Logon failed, use ctrl+c to cancel basic credential prompt.
    Logon failed, use ctrl+c to cancel basic credential prompt.
    Logon failed, use ctrl+c to cancel basic credential prompt.
    Remote "origin" does not support the LFS locking API. Consider disabling it with:
      $ git config lfs.https://dev.azure.com/{OrgName}/{ProjectName}/_git/{ProjectName}/info/lfs.locksverify false
    リモート リポジトリへのプッシュ中にエラーが発生しました: Git failed with a fatal error.
    failed to detect Username in target URL.
    unable to read askpass response from 'C:/program files (x86)/microsoft visual studio/2019/professional/common7/ide/commonextensions/microsoft/teamfoundation/team explorer/Git/mingw32/libexec/git-core/git-askpass.exe'
    could not read Username for 'https://dev.azure.com': terminal prompts disabled
    
```

## 試したこと

### Git LFSとGCMのアップデート

Windowsの資格情報マネージャーから資格情報の削除  
%LocalAppData%/GitCredentialManagerにあるtenant.cacheの削除  
をしてからGit LFSとGCMをそれぞれ 2.4.0 -> 2.11.0、??? -> 1.20 にアップデートしてVSからpush  
→「詳細」と同じ症状

### コマンドラインから実行

cmdでgit pushを実行しても認証用のポップアップが表示されて、ユーザ情報を入力しても失敗している様子です

```

    C:\Users\{UserName}\source\repos\{ProjectName}>git push
    Logon failed, use ctrl+c to cancel basic credential prompt.
    Logon failed, use ctrl+c to cancel basic credential prompt.
    Username for 'https://dev.azure.com': {Mail Address}
    Password for 'https://{Mail Address}@dev.azure.com':
    
```

### Git LFSを無効にしてpush

一時的に `git lfs uninstall` でGit LFSを無効にするとVSのpush手順で正常にpushできていることが確認できました

## 環境

git version 2.27.0.windows.1  
git-lfs/2.11.0 (GitHub; windows amd64; go 1.14.2; git 48b28d97  
Visaul Studio 16.6.0  
Windows 101903  
GCM for Windows 1.20

## 参考にした情報

Git LFSのアップデートが必要だと考えた情報  
<https://docs.microsoft.com/ja-jp/azure/devops/repos/git/lfs-
kerberos?view=azure-devops>  
tenant.cacheの削除が必要だと考えた情報  
<https://qiita.com/Mocci/items/dd91e509c204d15a855f>

## 更新

kkamegawa様に教えていただいた方法で出力した  
1\. `git push`を実行  
2\. ポップアップウィンドウでVSサブスクリプションアカウントを選択  
3\. 2回目のポップアップウィンドウが表示  
4\. Ctrl+Cでコマンド中断  
までのログになります

```

    19:09:09.609261 exec-cmd.c:237          trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
    19:09:09.612267 git.c:442               trace: built-in: git push
    19:09:09.618322 run-command.c:663       trace: run_command: GIT_DIR=.git git remote-https origin https://dev.azure.com/{OrgName}/{ProjectName}/_git/{ProjectName}
    19:09:09.664232 exec-cmd.c:237          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
    19:09:09.668237 git.c:702               trace: exec: git-remote-https origin https://dev.azure.com/{OrgName}/{ProjectName}/_git/{ProjectName}
    19:09:09.669231 run-command.c:663       trace: run_command: git-remote-https origin https://dev.azure.com/{OrgName}/{ProjectName}/_git/{ProjectName}
    19:09:09.781257 exec-cmd.c:237          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
    19:09:09.945247 run-command.c:663       trace: run_command: 'git credential-manager get'
    19:09:10.108232 exec-cmd.c:237          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
    19:09:10.111234 git.c:702               trace: exec: git-credential-manager get
    19:09:10.111234 run-command.c:663       trace: run_command: git-credential-manager get
    19:09:10.323232 ...\Common.cs:744       trace: [Main] git-credential-manager (v1.20.0) 'get'
    19:09:10.454244 ...\Git\Where.cs:348    trace: [FindGitInstallations] found 1 Git installation(s).
    19:09:10.466232 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 37 entries.
    19:09:10.553231 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://dev.azure.com/'.
    19:09:10.591232 ...uthentication.cs:199 trace: [DetectAuthority] 'https://dev.azure.com/{OrgName}/' is Azure DevOps, tenant resource is {a54b00a287e84e92a76dde53269b7ddd}.
    19:09:10.596230 ...uthentication.cs:359 trace: [GetAuthentication] AAD authority for tenant 'a54b00a287e84e92a76dde53269b7ddd' detected.
    19:09:10.679230 ...\Common.cs:140       trace: [CreateAuthentication] authority for 'https://dev.azure.com/' is Azure Directory.
    19:09:10.682235 ...\Common.cs:765       trace: [QueryCredentials] querying 'AzureDirectory' for credentials.
    19:09:10.701255 ...uthentication.cs:384 trace: [GetCredentials] credentials for 'https://dev.azure.com/' found.
    19:09:10.956230 ...\Common.cs:817       trace: [QueryCredentials] credentials for 'https://dev.azure.com/' found.
    19:09:10.959248 ...\Common.cs:709       trace: [LogEvent] Azure Directory credentials  for 'https://dev.azure.com/' successfully retrieved.
    19:09:11.292607 run-command.c:663       trace: run_command: 'git credential-manager store'
    19:09:11.413610 exec-cmd.c:237          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
    19:09:11.417617 git.c:702               trace: exec: git-credential-manager store
    19:09:11.417617 run-command.c:663       trace: run_command: git-credential-manager store
    19:09:11.579611 ...\Common.cs:744       trace: [Main] git-credential-manager (v1.20.0) 'store'
    19:09:11.683609 ...\Git\Where.cs:348    trace: [FindGitInstallations] found 1 Git installation(s).
    19:09:11.692624 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 37 entries.
    19:09:11.746609 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://PersonalAccessToken@dev.azure.com/'.
    19:09:11.780611 ...uthentication.cs:199 trace: [DetectAuthority] 'https://dev.azure.com/{OrgName}/' is Azure DevOps, tenant resource is {a54b00a287e84e92a76dde53269b7ddd}.
    19:09:11.785619 ...uthentication.cs:359 trace: [GetAuthentication] AAD authority for tenant 'a54b00a287e84e92a76dde53269b7ddd' detected.
    19:09:11.850608 ...\Common.cs:140       trace: [CreateAuthentication] authority for 'https://PersonalAccessToken@dev.azure.com/' is Azure Directory.
    19:09:11.855615 ...\Program.cs:522      trace: [Store] storing Azure DevOps credentials for 'https://PersonalAccessToken@dev.azure.com/'.
    19:09:11.900611 run-command.c:663       trace: run_command: 'git credential-manager store'
    19:09:11.998611 exec-cmd.c:237          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
    19:09:12.001610 git.c:702               trace: exec: git-credential-manager store
    19:09:12.001610 run-command.c:663       trace: run_command: git-credential-manager store
    19:09:12.133641 ...\Common.cs:744       trace: [Main] git-credential-manager (v1.20.0) 'store'
    19:09:12.226612 ...\Git\Where.cs:348    trace: [FindGitInstallations] found 1 Git installation(s).
    19:09:12.235610 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 37 entries.
    19:09:12.298614 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://PersonalAccessToken@dev.azure.com/'.
    19:09:12.342618 ...uthentication.cs:199 trace: [DetectAuthority] 'https://dev.azure.com/{OrgName}/' is Azure DevOps, tenant resource is {a54b00a287e84e92a76dde53269b7ddd}.
    19:09:12.347614 ...uthentication.cs:359 trace: [GetAuthentication] AAD authority for tenant 'a54b00a287e84e92a76dde53269b7ddd' detected.
    19:09:12.417609 ...\Common.cs:140       trace: [CreateAuthentication] authority for 'https://PersonalAccessToken@dev.azure.com/' is Azure Directory.
    19:09:12.419609 ...\Program.cs:522      trace: [Store] storing Azure DevOps credentials for 'https://PersonalAccessToken@dev.azure.com/'.
    19:09:12.467616 run-command.c:663       trace: run_command: .git/hooks/pre-push origin https://dev.azure.com/{OrgName}/{ProjectName}/_git/{ProjectName}
    19:09:12.621611 exec-cmd.c:237          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
    19:09:12.627630 git.c:702               trace: exec: git-lfs pre-push origin https://dev.azure.com/{OrgName}/{ProjectName}/_git/{ProjectName}
    19:09:12.627630 run-command.c:663       trace: run_command: git-lfs pre-push origin https://dev.azure.com/{OrgName}/{ProjectName}/_git/{ProjectName}
    19:09:12.739614 trace git-lfs: exec: git 'version'
    19:09:12.981616 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'rev-parse' 'HEAD' '--symbolic-full-name' 'HEAD'
    19:09:13.292611 trace git-lfs: exec: git 'config' '-l'
    19:09:13.339610 trace git-lfs: pre-push: refs/heads/master 6611973ed070c7e088c75e47dcee9280f57e4970 refs/heads/master 2e2238b11d43b2d28c594d25ce2e1d2859c9aa92
    19:09:16.465525 trace git-lfs: creds: git credential fill ("https", "dev.azure.com", "")
    19:09:16.490530 exec-cmd.c:237          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
    19:09:16.493524 git.c:442               trace: built-in: git credential fill
    19:09:16.496536 run-command.c:663       trace: run_command: 'git credential-manager get'
    19:09:16.582520 exec-cmd.c:237          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
    19:09:16.587526 git.c:702               trace: exec: git-credential-manager get
    19:09:16.587526 run-command.c:663       trace: run_command: git-credential-manager get
    19:09:16.741535 ...\Common.cs:744       trace: [Main] git-credential-manager (v1.20.0) 'get'
    19:09:16.831527 ...\Git\Where.cs:348    trace: [FindGitInstallations] found 1 Git installation(s).
    19:09:16.841528 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 37 entries.
    19:09:16.910518 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://dev.azure.com/'.
    19:09:17.147010 ...uthentication.cs:223 trace: [DetectAuthority] detected 'https://dev.azure.com/' as Azure DevOps from GET response.
    19:09:17.150013 ...uthentication.cs:291 trace: [DetectAuthority] tenant resource for 'https://dev.azure.com/' is {00000000000000000000000000000000}.
    19:09:17.156249 ...uthentication.cs:354 trace: [GetAuthentication] MSA authority detected.
    19:09:17.213191 ...\Common.cs:205       trace: [CreateAuthentication] authority for 'https://dev.azure.com/' is Microsoft Live.
    19:09:17.215311 ...\Common.cs:765       trace: [QueryCredentials] querying 'MicrosoftAccount' for credentials.
    19:09:23.105806 ...\Authority.cs:195    trace: [InteractiveAcquireToken] authority host URL = 'https://login.microsoftonline.com/common', token acquisition for tenant [a54b00a287e84e92a76dde53269b7ddd] succeeded.
    19:09:23.108816 ...Authentication.cs:86 trace: [InteractiveLogon] token 'https://dev.azure.com/' successfully acquired.
    19:09:23.214645 ...\Authority.cs:375    trace: [GetIdentityServiceUri] failed to find Identity Service for 'https://dev.azure.com/_apis/ServiceDefinitions/LocationService2/951917AC-A960-4999-8464-E3F0AA25B381?api-version=1.0' via location service [404].
    19:09:23.219665 ...\Authority.cs:136    trace: [GeneratePersonalAccessToken] ! error: 'Failed to find Identity Service for `https://dev.azure.com/`.'.
    19:09:23.223642 ...\Authority.cs:139    trace: [GeneratePersonalAccessToken] personal access token acquisition for 'https://dev.azure.com/' failed.
    19:09:23.224642 ...\Common.cs:854       trace: [QueryCredentials] credentials for 'https://dev.azure.com/' not found.
    19:09:23.229054 ...\Common.cs:709       trace: [LogEvent] Failed to retrieve Microsoft Live credentials for 'https://dev.azure.com/'.
    19:09:23.237895 ...\Program.cs:414      trace: [Get] Logon failed, use ctrl+c to cancel basic credential prompt.
    Logon failed, use ctrl+c to cancel basic credential prompt.
    19:09:23.306595 run-command.c:663       trace: run_command: 'git credential-manager get'
    19:09:23.392589 exec-cmd.c:237          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
    19:09:23.401591 git.c:702               trace: exec: git-credential-manager get
    19:09:23.401591 run-command.c:663       trace: run_command: git-credential-manager get
    19:09:23.558588 ...\Common.cs:744       trace: [Main] git-credential-manager (v1.20.0) 'get'
    19:09:23.678590 ...\Git\Where.cs:348    trace: [FindGitInstallations] found 1 Git installation(s).
    19:09:23.689588 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 37 entries.
    19:09:23.784590 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://dev.azure.com/'.
    19:09:24.060587 ...uthentication.cs:223 trace: [DetectAuthority] detected 'https://dev.azure.com/' as Azure DevOps from GET response.
    19:09:24.067588 ...uthentication.cs:291 trace: [DetectAuthority] tenant resource for 'https://dev.azure.com/' is {00000000000000000000000000000000}.
    19:09:24.071595 ...uthentication.cs:354 trace: [GetAuthentication] MSA authority detected.
    19:09:24.165590 ...\Common.cs:205       trace: [CreateAuthentication] authority for 'https://dev.azure.com/' is Microsoft Live.
    19:09:24.167600 ...\Common.cs:765       trace: [QueryCredentials] querying 'MicrosoftAccount' for credentials.
    19:09:28.975498 trace git-lfs: filepathfilter: rewrite ".git" as "**/.git/**"
    19:09:28.977511 trace git-lfs: filepathfilter: rewrite "**/.git" as "**/.git"
    19:09:28.985495 trace git-lfs: filepathfilter: accepting "tmp"
    
```

またPATを使った認証を実施したところ  
1\. `git push`実行  
2\. ポップアップが表示されてVSサブスクリプションアカウントを選択  
3\. 2をもう一度繰り返す  
4\. ユーザ名が聞かれるのでVSサブスクリプションアカウントのメールアドレスを入力  
5\. パスワードが聞かれるので作成したPATを入力  
という手順で正常にpushできたことを確認できました

しかし、VSのGUIでpushしようとしても「詳細」あるような症状のためpushはできていませんでした  
※操作実施前に資格情報の削除とtenant.cacheの削除は実施しました
CC BY-SA 4.0
2020-06-13T06:14:57.207
67619
2020-06-13T10:35:43.720
2020-06-13T10:35:43.720
19500
19500
question
visual-studio git azure
Azure DevOpsでGit LFSを有効にしたリポジトリのプッシュができない
一応確認ですが、Alternative
Credentials使ってBasic認証使われていないでしょうか？こちらは3月に使用不可になっているはずです。できるならば、PATを作ってみて、そちらで認証すると現象が変わるでしょうか？  
ベータ版ですが、[GCM .NET Core](https://github.com/microsoft/Git-Credential-Manager-
Core)もあるようです。  
また、環境変数 GCM_TRACE=1とGIT_TRACE=1を設定すればログが出るようですので、そちらも確認してください。

参考:[Development and Debugging](http://microsoft.github.io/Git-Credential-
Manager-for-Windows/Docs/Development.html)
CC BY-SA 4.0
2020-06-13T09:55:07.467
67625
2020-06-13T09:55:07.467
35711
67619
answer