繁体   English   中英

Git - 缓慢获取 - 凭证管理器主机提供程序

[英]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可能弄乱了我的配置:

[GetProviderAsync] Checking against 3 host providers registered with priority 'Normal'.

我的同事没有看到这样的行,并且只检查了一个主机提供商。 如何更改 git 凭据管理器使用的主机提供程序的配置?

更新:使用便携式版本的 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...

注册主机提供商的数量似乎很可疑,但我不知道如何更改。 此外 - 在每次提取时存储凭据似乎不是一件有效的事情。

更新 2:切换到 SSH 授权并没有太大帮助,因此延迟的根本原因与 GCM 无关。 我会进行更多调查,可能会结束这个问题。

通过以下方式测试这是否链接到您当前的 Git 以进行 Windows安装:

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 session。

当我遇到类似问题时,我没有像您那样使用 git 跟踪,但是每次我进行提取时都会收到 3 条“正在检测主机提供程序”消息。 我在 git 2.33.1.windows.1 之前没有使用 https 遥控器。 (2.33.1 显然停止允许 rsa/sha-1 密钥,我在故障排除时切换到个人访问令牌。)我已经在使用凭证管理器核心,所以我的解决方案是向 .gitconfig 添加一个 credential.provider 设置,告诉它我我正在连接到 bitbucket 服务器。

[credential]
    helper = manager-core
[credential "https://example.com"]
    provider = bitbucket

这样做之后,我没有收到任何“检测主机提供程序”消息,并且 git 获取现在运行得更快。 https://github.com/microsoft/Git-Credential-Manager-Core/blob/main/docs/configuration.md

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM