How to fix Git getting stuck or hanging for long periods of time?

Steven Rescigno
2 min readMay 22

Are you having an odd issue with your Git not working?

Sometimes your Git CLI may start to take to long or maybe even hang after a few commands…

This has happened on multiple occasions.

Here are some debugging you can do to troubleshoot you Git issues.

How to clean Git on your computer?

First try running the following command on your computer to fix an odd hanging in your git CLI.

git clean -f -n

If this still doesn’t work try using the following command on your computer to clear out duplicate Git Objects.

How to remove duplicates for your Git Objects?

We can run the following command to clean up git duplicates before we send them over to Github.

Try running the following command to clean up some Git Objects on your local computer.

git gc

Hope you find these tips helpful and save you tons of time when working with Git.

Happy Coding!!

P.S. If you’re a fan of Medium as much as we are, consider supporting me and the thousands of other writers by signing up for a membership.

It only costs $5 per month, and it supports us writers. We write without AI to ensure you know we are human. Thank you, Greatly.

Steven Rescigno

Designer | Developer | Medium Author