Git Bash (mintty) is extremely slow on Windows 10 OS

GitWindows 10Git BashMingw W64Mintty

Git Problem Overview


I installed Git on my Windows 10 a couple of months ago. It worked well for some time. But now, it's running very slow.

The git status command takes 7 seconds to execute, and git stash takes many minutes for stashing (even if there is nothing to stash). Also, I would like to point out that git status prints the result instantaneously, but I can not enter a new command for a few seconds, as shown in the image below.

The screen is stuck like this for 7 seconds

I have tried solutions to similar problems like link1, link2, etc., but none of these have worked.

P.S.: I use Windows Defender antivirus, and it is NOT making my Bash slow. Also, cmd takes more time to execute git commands while git bash takes longer to run any command.


Update: I have switched to Ubuntu, and therefore, I don't use Windows presently. So, there is no way I can check if any of the solutions work for me. I have accepted the answer provided by @pschild since it has the most upvotes and seems to have worked for many people.

Git Solutions


Solution 1 - Git

I recently ran into the exact same issue. After trying all the advice from this thread and a lot of other threads, I finally found a solution here, respectively in the linked issue here.

Disabling AMD Radeon graphics driver in the Windows device manager and switching to integrated Intel HD graphics worked for me - for whatever reason.

Hope that helps!

In my case, I found sh.exe shell to be significantly faster than bash.exe. You can find sh.exe in git_install_dir/bin.

Hope this helps people having this issue while only having integrated Intel HD graphics!

Solution 2 - Git

For me, the solution was to set the HOME variable to my user directory (per this answer). To do this (at least on Windows 7):

  1. Right-click on "Computer" in file explorer.
  2. Open Advanced System Settings.
  3. Open Environment Variables
  4. Under System Variables, click "New..."
  5. Enter "HOME" for the variable name and the path to your user directory for the value (for example "C:\Users\jdoe").

See also the answers to this related question.

Solution 3 - Git

I had the same problem once and what I found is that the issue for me was with __git_ps1, basically a variable that includes status informationlike branch name, detached head state, in the git dir, in a bare repo, in the middle of cherry picking or rebasing or merging.

In order to speed up your git bash, go to $GitHome\etc\profile and comment out the if-then where __git_ps1 is added to PS1.

Anyway the information that you are commenting out are quite useful, expecially if you are at the beginning with GIT. Here is a faster version, found on the internet and used by me quite succesfully on my system:

fast_git_ps1 ()                                                                              
{                                                                                            
    printf -- "$(git branch 2>/dev/null | grep -e '\* ' | sed 's/^..\(.*\)/ {\1} /')"    
}                                                                                            

PS1='\[\033]0;$MSYSTEM:\w\007                                                                
\033[32m\]\u@\h \[\033[33m\w$(fast_git_ps1)\033[0m\]                                         
$ '     

Solution 4 - Git

In response to Lafexlos's bounty:

> Disabling AMD Radeon driver solved my issue but I am really wondering on why part.
Would appreciate an answer which focuses on that.

As to why:

Issue 1070 reports.

> Bringing up the Radeon settings GUI and clicking on something while waiting for the bash prompt immediately releases something and makes it appear - weird.

AMD was contacted but no response...

This project reports:

> But all of the graphic (terminal) output has to be displayed via those drivers.
They (the drivers) get their hooks into all parts of the system with hidden interrupts and time outs and goodness knows what. Shudders..

Issue 1129 adds:

> Starting with Windows 7 (maybe Vista?) the console had the ability to display itself via DirectWrite, which is build on top of Direct3D, which is heavily dependent on driver implementations of DirectX API. > > As a former NVIDIA employee who worked directly on nvd3dum, nvwgf2umx and nvapi I can tell you we were rather skeptical of the wisdom of this decision.
Seems AMD should have been more skeptical, perhaps their driver quality would have been better.

Solution 5 - Git

Try again with:

  • the latest Git for Windows you can find, like PortableGit-2.12.1-64-bit.7z.exe (unzip it anywhere you want, no setup)

  • then in a CMD session, set your PATH with:

      set G=c:\path\to\latest\git
      set PATH=%G%\bin;%G%\usr\bin;%G%\mingw64\bin
      set PATH=%PATH%;C:\windows\system32;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\
    
  • set your HOME in that same CMD session

      set HOME=%USERPROFILE%
    
  • Finally, type bash, and see if any Git operation is still slow.

Solution 6 - Git

I had same issue on Windows 7 and Window 10, while using the git bash, any command that I run would take considerable time to execute. Finally after many of head breaking trials, found that issue was due to not running my git bash exe as administrator,

Steps

  1. Right click on git bash exe.
  2. click on 'run as administrator'
  3. type in commands like cd /c/

hope this helps!!!!

Solution 7 - Git

Is your PATH full of junk? Simple commands were taking 20 seconds or more for me sometimes until I removed unnecessary things from my PATH.

Windows: echo %PATH%

Search "edit environment variables" to change.

Other: echo $PATH

Solution 8 - Git

Tried everything above that made any sense to me, did not help.

Finally I seem to have fixed the issue. Turned out, Git Credentials Manager for Windows tried to contact my domain controller (that is out of reach since I'm out of the office), and that caused a great delay (30+ seconds) each time I wanted to e.g. git checkout.

To fix this, just had to disable the Credentials Manager completely, now everything's reasonably fast. This is how to disable it: https://stackoverflow.com/questions/37182847/how-do-i-disable-git-credential-manager-for-windows

Hope this helps the desperate ones, cheers!

Solution 9 - Git

I have a similar problem but only when I ran git bash as a normal user, when I started git bash as an Administrator all commands ran really fast.

In my case it turned out that the problem was caused by F-Secure antivirus. I added directory containing git.exe to the list of excluded directories (excluded from scanning) and it solved this problem for me.

How to exclude directory: https://community.f-secure.com/t5/Business/Excluding-objects-from-Real-Time/ta-p/66013

Excluded locations window as of version 21

Solution 10 - Git

Adding process exclusion for bash.exe, cmd.exe and conhost.exe in Windows Defender Exclusions list apparently solved the issue for me on Windows 10 64bit.

Solution 11 - Git

For me, the problem was in the installed software Strawberry Perl.

I was using next open-source software for Windows 10:

  • OpenSSH
  • Putty
  • Git for Windows
  • Qt 5.12.6

But, the installator Qt 5.12.6 prompts you to install Strawberry Perl. It seems like this package is needed to automate the creation of software deployment scripts. Strawberry Perl have more open-source software besides the Perl. But in reality in 99% of cases Strawberry Perl installation is unnecessary.

Before uninstall Strawberry Perl, my PATH variable became like this:

PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Program Files\PuTTY\;C:\Strawberry\c\bin;C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;C:\Users\stepanov_sm\AppData\Local\Microsoft\WindowsApps;

After uninstall Strawberry Perl, my PATH variable became like this:

PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Users\stepanov_sm\AppData\Local\Microsoft\WindowsApps;C:\Windows\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Program Files\PuTTY\;

May be, Strawberry Perl overlap binaries/scripts from Git for Windows. Before uninstall Strawberry Perl, the command git --version executed within 45 seconds! After uninstall Strawberry Perl, the command began to be executed instantly.

Solution 12 - Git

Commands like pull, push, etc. seemed to take forever on git bash. Trying on git windows command line prompted github authentication was necessary (web browser/personal token). On authentication, commands started working fine on git windows and git bash as well.

Issue: https://github.com/git-for-windows/git/issues/3284

Solution 13 - Git

Upgrading to Windows 11 resolved this problem for me. Git console is now as fast as a native command prompt or powershell console. So, if

  1. You are peeved enough about the slow git console, and
  2. Your system is a personal computer that meets the upgrade 11 requirements,
  3. You don't mind these changes/deprecations,

I say give it a try.

Solution 14 - Git

Disclaimer: Not a fix. But quick workaround.

For some reason after my computer updated-- I didn't have Git bash on my computer so I had to redownload the new one 2.19.2.windows.1 and I had the same issue with every execution taking 5-7 seconds.

I didn't have time to look into all of the links and disable graphics drivers and what not. But I had Git shell installed with Github on my computer and I pulled that up (Windows PowerShell) and I could run everything on there I needed immediately.

Solution 15 - Git

I was running Windows 10 as a virtual machine (using VMware fusion), and for me, changing from 1 to 2 processor cores in the virtual machine setup (which I discovered was the recommended minimun anyway) fixed the problem. The comment by @chunk_split on @rakwaht's answer points in the same direction (i.e. an issue with concurrent threads or processes slowing things down).

Solution 16 - Git

I have been strugling with git bash since 2 months because my colleauge( root problem) told me to store git credentials and I don't know what happend to windows 10 but it screwed up. What I have noticed that whenever it starts it is checking the connection to domain server. here goes my solution. I have removed from these arguments from properties -> start at: %HOMEDRIVE%%HOMEPATH%.

Start -> Search Git Bash -> Open Location of File -> Git Bash -> Right Click -> Properties -> Direct Access -> Start At and remove it whatever you have there.

enter image description here

Solution 17 - Git

For me, the solution was to set the HOME environment variable to my Users folder.

Go to Start - type "environment" - Select "Edit environment variables for your account"

In the top list, check if HOME variable is there. If it's there, change it's value. If it's not there, click on New....

The Variable name will be HOME and Variable value will be path for example C:\Users\<username>.

The reason why this helped to me is that by default, the Home directory in my case, was pointing to shared network drive. This was slowing down the GIT, because it was connecting to that network drive.

Solution 18 - Git

For me, what fixed was:

  1. Update git bash (version 2.34.1+)
  2. Run as Admin (so it will run all post-install scripts)
  3. Done

After this, my git bash was opening very fast.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionRohan BhatiaView Question on Stackoverflow
Solution 1 - GitpschildView Answer on Stackoverflow
Solution 2 - GitPaul WintzView Answer on Stackoverflow
Solution 3 - GitrakwahtView Answer on Stackoverflow
Solution 4 - GitVonCView Answer on Stackoverflow
Solution 5 - GitVonCView Answer on Stackoverflow
Solution 6 - GitPramod C VView Answer on Stackoverflow
Solution 7 - GitPhilip RegoView Answer on Stackoverflow
Solution 8 - GitKostiantyn KoView Answer on Stackoverflow
Solution 9 - GitcsharpfolkView Answer on Stackoverflow
Solution 10 - GitmarkView Answer on Stackoverflow
Solution 11 - GitXintreaView Answer on Stackoverflow
Solution 12 - GitSumanjit SenguptaView Answer on Stackoverflow
Solution 13 - GitSahilView Answer on Stackoverflow
Solution 14 - GitdkoView Answer on Stackoverflow
Solution 15 - GitOtto GView Answer on Stackoverflow
Solution 16 - GitkambojView Answer on Stackoverflow
Solution 17 - GitMartin819View Answer on Stackoverflow
Solution 18 - GitLuan PersiniView Answer on Stackoverflow