Search code examples
gitvisual-studio-code

Git through VSCode is unusably slow


I currently have an issue that I can't properly pin down at the moment.

When I try to use Git through VSCode, either through starting a Git-Bash Terminal or using the GUI tools it takes a monumental amount of time to actually run the commands.

It seems to be random, but as an example when running, "git push -u origin main" it has taken anywhere from 2:37 Minutes up to 17:03 Minutes An example just run now

In comparison when I run the exact same command on the exact same folder but instead through the stand alone GitBash it takes about 2 seconds to run.


So I was just wondering if anyone could help with either of these two things;

  • If anyone knows why it would be running this slow?
  • And is there any way I could check what it is doing when running those commands (so I can figure out why it is running that slow)

Thank you.

6/4/22 EDIT

I have tested this on another computer in our environment and then on my personal computer. Zero issues on the personal, but the computers in my work environment are still running Git Commands through VSCode very slowly.

So as I assumed, it is most likely an issue related to something in our environment (but not network related). But I still wish to know why is it taking such a long time or How can I figure this information out myself?

29/03/23 EDIT

I see that this question has had a lot of views so I just wanted to clarify for anyone else having this issue.

  • My issue was resolved by doing the Trace and seeing the credential manager core was my issue. I reinstalled GIT without the credential manager
  • I do not know why the credential manager had issue on my machine. But my environment is heavily restricted - so I imagine it is related to that
  • I recommend trying the same commands in the GIT Bash (Not through VSCode). Then, confirming the slowness is unique to Visual Studio Code. Run the trace as given in the answer, find the line that is taking the long time and go from there.

Solution

  • why is it taking such a long time or How can I figure this information out myself?

    One possibility is to activate, in your VSCode Git bash session, GIT_TRACE2 flags, that you can see listed here.

    At least:

    export GIT_TRACE2_PERF=1
    # your git commands