Unresponsive git status, diff, add (hanging)

yunque picture yunque · Apr 10, 2017 · Viewed 9.8k times · Source

The following git commands hang (do not respond) in one of my repositories:

git status
git diff
git stash
git add

The fact that I cannot git add leads me to believe that the unresponsiveness isn't simply due to very large files. Since git stash also hangs, I don't think it's merely a problem with communicating with origin.

git remote show origin shows the expected remote URL. I'm working on a branch and have checked that it has not been renamed. (FWIW, the origin is hosted on bitbucket.)

All the above commands respond as expected in a different repo, so it's not due to the internet connection.

Any other tips for troubleshooting this?

Answer

Antoni picture Antoni · Jul 19, 2018

For whatever it's worth, try git fsck (as per one of the comments) then git gc. When runninggit status and git commit, they where hanging for me after processing a number of files; and running those commands fixed the issue. I don't which command actually fixed the problem.