windowsgit-bash

git bash suddenly slow on every command not only git command


I have git bash in WIN 10. Since last week suddenly every command (ls, cd, git, ...) runs very slow, even ctrl-c. After type a command it pauses, and then shows result, before command completes, it pauses another while. I remembered last week there was a 3D Graphics GPU something in notification corner during that time. I checked that I don't have GPU in this PC, and it is GeForce 630 with a 2017 driver. (heard that AMD driver can cause such problem).


Solution

  • Git Bash is slow in normal mode, most probably caused by 3rd-party software or drivers, so it is worth trying to see if it works better in Safe Mode.


    Step 1: Test in Safe Mode

    Boot into Safe Mode to see if Git Bash runs smoothly.


    Step 2: Enable Git Optimizations

    Run the following in Git Bash (on newer version ):

    git config --global core.preloadindex true
    git config --global core.fscache true
    git config --global gc.auto 256
    

    Citation accessible from git help config (opens up a documentation page in your default browser)

    core.preloadIndex Enable parallel index preload for operations like git diff This can speed up operations like git diff and git status, especially on filesystems like NFS that have weak caching semantics and thus relatively high IO latencies. When enabled, Git will do the index comparison to the filesystem data in parallel, allowing overlapping IO’s. Defaults to true.

    core.fscache Enable additional caching of file system data for some operations. Git for Windows uses this to bulk-read and cache lstat data of entire directories (instead of doing lstat file by file).

    gc.auto When there are approximately more than this many loose objects in the repository, git gc --auto will pack them. Some Porcelain commands use this command to perform a light-weight garbage collection from time to time. The default value is 6700. Setting this to 0 disables not only automatic packing based on the number of loose objects, but also any other heuristic git gc --auto will otherwise use to determine if there’s work to do, such as gc.autoPackLimit.

    In a nutshell:

    Verify that settings are set by running:

    git config --list
    

    You should see:

    core.preloadindex=true
    core.fscache=true
    gc.auto=256
    

    Step 3: Simplify Your Shell Prompt (Optional but Effective)

    Complex shell prompts that show Git status can slow down the terminal.

    🔧 Edit your ~/.bashrc or ~/.bash_profile:

    export PS1='\u@\h:\w\$ '
    

    📖 More tips:


    Step 4: Isolate Conflicting Services

    1. Press Win + R, type msconfig, hit Enter
    2. Go to the Services tab
    3. Check “Hide all Microsoft services”
    4. Disable the remaining (non-Microsoft) services - Focus on mouse/keyboard software, monitoring tools (e.g., MSI Afterburner), sync tools (OneDrive, Dropbox), and GPU overlays
    5. Reboot and test Git Bash

    ➡️ If Git Bash works now:


    Step 5 Antivirus & Defender Exclusions

    Many AV tools slow down Git Bash by scanning each command execution.

    Add exclusions for files within C:\Program Files\Git\bin\ folder:

    🔐 For Windows Defender

    1. Open Settings
    2. Go to Privacy & SecurityWindows SecurityVirus & threat protection
    3. Click Manage Settings → Scroll down to Exclusions
    4. Add the .exe files listed above

    Step 6: Reinstall Git Bash

    1. Uninstall Git Bash
    2. Delete leftover config files (optional): %USERPROFILE%\.gitconfig, %ProgramFiles%\Git
    3. Download and reinstall the latest Git for Windows

    Choose the minimal/default settings and avoid extra PATH/global overrides if unsure.

    Files that start with the .(dot), might not be visible

    1. Win + E - opens File Explorer
    2. at the top right corner of the File Explorer click arrow ⬇️ (down to expand the menu) or Windows 11 it three vertical dots.
    3. Click Options
    4. Tab View
    5. Under Files and Folders, find Hidden files and folders
    6. Select Show hidden files, folders, and drives
    7. Click Apply and Ok

    Now, you should see any hidden files or folders.


    Step 7: Event Viewer Logs

    If the issue persists:

    These logs may reveal:

    Then, try checking Windows logs: - Application logs - records events related to the Windows system components, such as drivers and built-in interface elements; - System logs - record events related to programs installed on the system.

    You must be looking at the column Level (Error) after trying to run the commands (that freeze your git bash). Look at the date and time column to check the most recent one.

    Then by going to eventvwr you may see some new warning/error (most probably that hangs up your console) See the Event viewer error example (you could use the error message and Event ID to Google the problem): event viewer image


    Step 8: GPU Driver Rollback / Update

    If you saw a "3D GPU" notification recently:

    1. Win + X
    2. Open Device Manager
    3. Expand Display Adapters
    4. Right-click your GPU (e.g., GeForce GT 630) → Properties
    5. Go to the Driver tab
    6. Try

    See How to Stop Windows 10 Apps From Launching at Startup

    Step 9 Additional attempts:

    Uninstalling any recent software

    control panel ➡️ programs and features - try uninstalling it, after which you may have noticed this behavior.


    🧪 Additional Tools (Advanced)

    If none of the above helps:

    Try using Restore point if you have any

    See Recovery options in Windows

    Reinstalling windows

    By going to the Windows 10 website and downloading the tool in the Create Windows 10 installation media section.


    🧠 Helpful Resources

    1. 🔗 Git Bash is extremely slow on Windows 7 x64
    2. 🔗 What is git gc?
    3. 🔗 Why is core.preloadindex false by default?