0

When opening Git bash or running any command, the time it takes to complete these actions is agonizingly long. The startup time is also way too long. However, if I disable my network connection, it works normally. Here is what I have tried that didn't work:

  • Commenting out "helper = manager" in the config.
  • Changing the credential provider from Azure, which it was set to a long time ago, back to https://www.github.com/ in the config.
  • Running Bash as an administrator.
  • Making sure $HOME points to a local directory.

I saw something about an AMD issue and switching to integrated graphics, but I don't have an AMD graphics card and I play games that would be unplayable on integrated graphics. Given that I have to work with a remote repo for school, disabling my network connection is not an option either. I also don't want to switch to the windows command shell, and I don't have another device.

I'm not sure how to check trace logs, but I'm willing to try. I'm running on Windows 10 with bash version 5.2.15(1)-release, and my profile . Any ideas on what I'm missing?

Lee
  • 67
  • 5

1 Answers1

1

First, check what $HOME is when opening a bash: any $HOME on a network drive is bound to slow Git operation.

Second, activate trace2 API (Git 2.22+, Q2 2019), especially the perf one:

$ export GIT_TRACE2_PERF_BRIEF=1
$ export GIT_TRACE2_PERF=~/log.perf
git version

You can then see what takes time in a typical Git operation.

As noted in the discussion, the same commands executed from a CMD with the right %PATH% are working just fine, even with network connected.

set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\
set "GH=%ProgramFiles%\Git"
set "PATH=%GH%\bin;%GH%\cmd;%GH%\usr\bin;%GH%\mingw64\bin;%GH%\mingw64\libexec\git-core;%PATH%"

As noted by Raymond Chen in the comments, double-check your .bashrc and see if a $PS1 (__git_ps1) is the culprit: the prompt could take time to be formed after each command execution.
Shortening said prompt should help.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I forgot to mention that I checked $HOME already. I'll add that in. – Lee Apr 01 '23 at 23:20
  • 1
    @Lee OK, remains the perf log. Check also where your configs are with, in a local repository: `git config --show-origin --show-scope -l`: is there any network path there? – VonC Apr 01 '23 at 23:21
  • Program files and home directory are all I see when I run that. Perf log is sort of hard to interpret, but figures seem to range between 0.06 and 0.14. – Lee Apr 02 '23 at 00:01
  • @Lee That seems fast enough. Is this with network pluged in? – VonC Apr 02 '23 at 00:28
  • Yes, this is with it plugged in. I put the logs in a slightly different format and all of the times it reports are very normal. I should note that if I run a command like pwd, the output comes right away, but there is a delay AFTER the output before I get the cursor back. – Lee Apr 02 '23 at 00:34
  • @Lee Mmm, antivirus maybe? Is this only in a Git bash, or do you have the same issue in a CMD [with the `%PATH%` set](https://stackoverflow.com/a/75433297/6309) to include Git/Linux commands? – VonC Apr 02 '23 at 00:40
  • Added that to the path and it works fine in CMD. Antivirus doesn't seem to be doing anything strange. I might try a re-install at this point. – Lee Apr 02 '23 at 01:13
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/252920/discussion-between-vonc-and-lee). – VonC Apr 02 '23 at 01:14
  • Maybe it is your prompt that is slow. – Raymond Chen Apr 02 '23 at 02:14