[英]Git - slow fetch - credential manager host providers
I have noticed that git operations slowed down recently, it might be related to the upgrade of git and using credential-manager-core instead of credential-manager, I've tried to diagnose the issue using GCM_TRACE=1 git fetch
, looks like I might have messed up my configuration: I have noticed that git operations slowed down recently, it might be related to the upgrade of git and using credential-manager-core instead of credential-manager, I've tried to diagnose the issue using
GCM_TRACE=1 git fetch
, looks like I可能弄乱了我的配置:
[GetProviderAsync] Checking against 3 host providers registered with priority 'Normal'.
My colleague does not see such line and only one host provider is checked.我的同事没有看到这样的行,并且只检查了一个主机提供商。 How can I change the configuration of host providers used by git credential manager?
如何更改 git 凭据管理器使用的主机提供程序的配置?
Update: Using a portable version of git did not help, trace output below:更新:使用便携式版本的 git 没有帮助,请在下面跟踪 output:
[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...
Number of registered host providers seems suspicious but I do not know how it can be changed.注册主机提供商的数量似乎很可疑,但我不知道如何更改。 Also - storing credentials on each fetch does not seem like an efficient thing to do.
此外 - 在每次提取时存储凭据似乎不是一件有效的事情。
Update 2: Switching to SSH authorization did not help much, so the root cause of delays is not related to GCM.更新 2:切换到 SSH 授权并没有太大帮助,因此延迟的根本原因与 GCM 无关。 I'll investiage a bit more and probably close the question.
我会进行更多调查,可能会结束这个问题。
Test if this is linked to your current Git for Windows installation by:通过以下方式测试这是否链接到您当前的 Git 以进行 Windows安装:
PortableGit-2.31.1-64-bit.7z.exe
, auto-extractible) in a new folder ( C:\git
for instance)C:\git
)中解压缩便携式版本(如PortableGit-2.31.1-64-bit.7z.exe
,可自动提取)%PATH%
in a CMD session%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
git fetch
问题是否仍然存在That way, you don't disturb your current setup, and limit your tests to a single CMD session.这样,您就不会干扰您当前的设置,并将您的测试限制在单个 CMD session。
I did not use the git trace as you did when I had a similar issue, but I was getting 3 "detecting host provider for" messages every time I did a fetch.当我遇到类似问题时,我没有像您那样使用 git 跟踪,但是每次我进行提取时都会收到 3 条“正在检测主机提供程序”消息。 I was on git 2.33.1.windows.1 and wasn't using https remotes before then.
我在 git 2.33.1.windows.1 之前没有使用 https 遥控器。 (2.33.1 stopped allowing rsa/sha-1 keys apparently, and I switched to personal access tokens while troubleshooting.) I was already using credential manager core so my solution was to add a credential.provider setting to.gitconfig telling it that I am connecting to a bitbucket server.
(2.33.1 显然停止允许 rsa/sha-1 密钥,我在故障排除时切换到个人访问令牌。)我已经在使用凭证管理器核心,所以我的解决方案是向 .gitconfig 添加一个 credential.provider 设置,告诉它我我正在连接到 bitbucket 服务器。
[credential]
helper = manager-core
[credential "https://example.com"]
provider = bitbucket
After doing this I don't get any "detecting host provider" messages and git fetch runs much faster now.这样做之后,我没有收到任何“检测主机提供程序”消息,并且 git 获取现在运行得更快。 https://github.com/microsoft/Git-Credential-Manager-Core/blob/main/docs/configuration.md
https://github.com/microsoft/Git-Credential-Manager-Core/blob/main/docs/configuration.md
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.