joinkss
joinkss

Reputation: 21

OSX terminal running slow in git repositories

I've noticed that whenever I type a command within a local git repository it takes around 7-8 seconds to register keystrokes and another 7-8 seconds to begin running the command. I've checked my logs from other apps like anti-virus software and haven't found anything obscenely large. I use iTerm, but I've also checked that the exact same thing happens when using Terminal.

Any ideas on what the problem could be?

If it helps, I'm on OSX Yosemite.

Upvotes: 2

Views: 3264

Answers (3)

Hekuran S. Doli
Hekuran S. Doli

Reputation: 101

Please make sure you don't have large directories that are unnecessary to stay on your git cache. It is a good practice to exclude compilation directory that contain large binaries from version control (directories like bin, obj, etc.). In case you are using nodejs, sometimes node_modules gets extremely large, and it is a good idea to remove it from git.

git rm --cached -r node_modules

Then dont forget to add those directories to .gitignore

Upvotes: 0

Tara Mishra
Tara Mishra

Reputation: 194

Running git status and then pushing the few of the new changes seemed to fasten up the response of iterm for me.

Upvotes: 6

Dan Lowe
Dan Lowe

Reputation: 56498

Most likely, you have something running in your shell prompt which checks and reports the repository's current state. Many shell frameworks will do this (such as oh-my-zsh, or bash-it). They check the state of the repository every time a prompt is displayed.

If you are in a repository that is for some reason very slow to report its status, that might display this behavior. Some possible reasons include:

  • The repository is on a storage device (disk, USB stick, NAS) which is experiencing a problem, and is slow to respond.

  • The repository is on a network-mounted filesystem which is slow to respond.

  • The repository is on a low-performance filesystem mount, such as mounted into a virtual machine.

Upvotes: 3

Related Questions