我注意到最近 git 操作变慢了,可能与 git 升级和使用 credential-manager-core 而不是 credential-manager 有关,我尝试使用 GCM_TRACE=1 git fetch
诊断问题,看起来我可能搞砸了我的配置:
[GetProviderAsync] Checking against 3 host providers registered with priority 'Normal'.
我的同事没有看到这样的行,只检查了一个主机提供商。如何更改 git 凭证管理器使用的主机提供程序的配置?
更新: 使用便携式版本的 git 没有帮助,跟踪输出如下:
[RunInternalAsync] Version: 2.0.394.50751
[RunInternalAsync] Runtime: .NET Framework 4.0.30319.42000
[RunInternalAsync] Platform: Windows (x86-64)
[RunInternalAsync] AppPath: git-credential-manager-core
[RunInternalAsync] Arguments: get
[ExecuteAsync] Start 'get' command...
[ExecuteAsync] Detecting host provider for input:
[ExecuteAsync] protocol=https
[ExecuteAsync] host=dev.azure.com
[ExecuteAsync] path=........
[ExecuteAsync] username=........
[GetProviderAsync] Performing auto-detection of host provider.
[GetProviderAsync] Checking against 3 host providers registered with priority 'Normal'.
[ExecuteAsync] Host provider 'Azure Repos' was selected.
[GetCredentialAsync] Looking for existing credential in store with service=https://........ account=...
[GetCredentialAsync] Existing credential found.
[ExecuteAsync] End 'get' command...
[RunInternalAsync] Version: 2.0.394.50751
[RunInternalAsync] Runtime: .NET Framework 4.0.30319.42000
[RunInternalAsync] Platform: Windows (x86-64)
[RunInternalAsync] AppPath: git-credential-manager-core
[RunInternalAsync] Arguments: store
[ExecuteAsync] Start 'store' command...
[ExecuteAsync] Detecting host provider for input:
[ExecuteAsync] protocol=https
[ExecuteAsync] host=........
[ExecuteAsync] path=................
[ExecuteAsync] username=..............
[ExecuteAsync] password=********
[GetProviderAsync] Performing auto-detection of host provider.
[GetProviderAsync] Checking against 3 host providers registered with priority 'Normal'.
[ExecuteAsync] Host provider 'Azure Repos' was selected.
[StoreCredentialAsync] Storing credential with service=............. account=...............
[StoreCredentialAsync] Credential was successfully stored.
[ExecuteAsync] End 'store' command...
注册主机提供商的数量似乎很可疑,但我不知道如何更改。 此外 - 在每次获取时存储凭据似乎不是一件有效的事情。
更新 2: 切换到 SSH 授权并没有太大帮助,因此延迟的根本原因与 GCM 无关。我会进行更多调查,可能会结束这个问题。
答案 0 :(得分:1)
通过以下方式测试这是否与您当前的 Git for Windows 安装相关联:
C:\git
)中解压缩便携式版本(如 PortableGit-2.31.1-64-bit.7z.exe
,自动提取)%PATH%
set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\
set GH=C:\path\to\git
set PATH=%GH%\bin;%GH%\usr\bin;%GH%\mingw64\bin;%GH%\mingw64\libexec\git-core;%PATH%
git fetch
上是否仍然存在这样,您就不会打扰您当前的设置,并将您的测试限制在单个 CMD 会话中。