windows - Git 在 Windows 10 上运行缓慢

标签 windows git visual-studio-2015 atlassian-sourcetree git-for-windows

我有一台配备 SSD、16GB RAM 和 i7 处理器的 Windows 10 笔记本电脑。

我已阅读此主题,但没有任何解决方案有帮助。 Git/Bash is extremely slow in Windows 7 x64

我曾尝试在以下场景中使用 Git:

  1. 命令提示符
  2. Git Bash 外壳
  3. Visual Studio 2015
  4. 源代码树

所有这些都几乎无法使用。例如,在我开始输入这个问题之前,我从命令提示符运行了以下命令:

git flow feature start "Separate_Cash_Incentives"

它已经运行了 10 多分钟,还没有完成。

当我查看我的任务管理器时,我的 CPU 为 10%,我的内存为 40%,我的磁盘为 5%。

目前有 10 个“Git for Windows”进程在运行,所有进程都显示 0% CPU。

我该如何解决这个问题?

谢谢!

编辑:看起来大多数缓慢发生在创建或 merge 分支时。只需执行简单的提交或推送就非常快。

最佳答案

只是为了测试,尝试一下

尝试并:

  • 解压PortableGit-2.12.2.2-64-bit.7z.exe (如果你有 Windows 64 位)你想要的任何地方。
    例如:C:\git\2.12.2.2
  • 打开常规 CMD 控制台并将 PATH 设置为:

    set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\
    set PATH=%PATH%;C:\git\2.12.2.2\bin;C:\git\2.12.2.2\cmd;C:\git\2.12.2.2\usr\bin;C:\git\2.12.2.2\mingw64\bin
    

然后输入 bash -l -i 看看 Git 是否仍然很慢。

目标是确保您与 PATH 中的其他软件没有任何冲突。

此外,尝试并(用于测试)证明您的防病毒软件在这里是否有任何副作用。

最后,确保你的代码库在你的本地驱动器上(不能通过网络或共享安装文件夹访问)

如果一个简单的异常规则(例如在 git 安装文件夹上)是否足以让 git 正常运行(即,如果 AV 设置为检查它的 git,还有待测试安装文件夹)。


It appears that the majority of the slowness happens when creating or merging branches.

说到 merge ,Git 2.28(2020 年第 3 季度)将包括针对常见情况的一些代码优化。

参见 commit 8777616 (2020 年 5 月 19 日)Andrew Ng (andrewyng) .
(由 Junio C Hamano -- gitster -- merge 于 commit 0739479 ,2020 年 6 月 2 日)

merge: optimization to skip evaluate_result for single strategy

Signed-off-by: Andrew Ng

For a merge with a single strategy, the result of evaluate_result() is effectively not used and therefore is not needed, so avoid altogether.

On Windows, this optimization can halve the time required to perform a recursive merge of a single commit with the LLVM repo.

关于windows - Git 在 Windows 10 上运行缓慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43308055/

相关文章:

git - 如何删除 git-svn 中的空目录?

c# - 无法加载或创建VS 2015.1。项目。无法创建Visual C#2015编译器

c++ - VS2015 中奇怪的 memcpy_s 行为

php - 'C :\wmic' is not recognized as an internal or external command, 可运行的程序或批处理文件

windows - Windows 7 shell 中未完全显示可执行版本

windows - 如何使用 Ruby 检查用户是否是 Windows 中的组的成员?

Git push 不会忽略 .gitignore 中的文件

git - 谁删除了我在 git 中的更改?

angularjs - 如何在 Protractor 中配置 firefox 二进制位置?

visual-studio-2015 - 如何在 .Net Core 项目中禁用 TypeScript 编译?