Solve The Error “git did not exit cleanly exit code 128”

Git is open-source and free software that is mostly used for the modern version control system. It is widely used by programmers and developers to handle small as well as large projects with efficiency and high speed. Being a version control system, it allows you to keep a tab on code changes. Git is known for its flexibility, security, performance, and functionality that is ideal for developers and programmers all over the world. Git is a simple and easy-to-learn system that even beginners are trying to learn. Tortoise Git is also a free and open-source client tool that helps you with the icons overlay that shows the status of the file. Its repositories are based on git. When working with TortoiseGit, you may experience the error “git did not exit cleanly exit code 128′‘.

Errors are never the end of the code you are compiling or the tool you are using. The right approach to crack the code is to find the relevant information. As you are here to find the relevant information, we not only provide the info and also the solutions to remove the error. First, check out how the error occurs

How do you get the error warning?

When you try to submit a new commit using TortoiseGit, you get the error warning. This is exactly how the error looks

Error: git did not exit cleanly exit code 128

Error: git did not exit cleanly exit code 128

How To Solve the Error “git did not exit cleanly exit code 128”

We come up with a few really effective solutions that can help you make the error go away.

Solution 1 – Set username and email

To fix the error, you need to set up the username and email. To do that, follow the below command

git config --global "[email protected]"
git config --global "Your Name"?

Solution 2 – For Windows 7 64-bit user

If you are Windows 7 64-bit user, then you will have a useful response from the Git-gui. In the case of crashed git and lock file, use the manual way. If you see git/ref/heads/branchname.lock, delete it. The error warning that was popping up will go away.

Solution 3 – Delete the Index.lock file

The next solution to handle the error message is to find if you have the index.lock file in your git folder. If you have it in your folder, then delete it. You need to make sure to delete it before you try to attempt to push the file again.

Solution 4 – Stash the modifications

Another helpful solution to solve the error efficiently is to make sure to stash all the modifications before pushing or pulling again.

Solution 5 – Ultimate tip

If any of the above-mentioned solutions don’t work, the ultimate tip is to try to launch the Git bash and run your git there. It shows you a better error warning.


In this post, we shed light on the solutions to fix the error “git did not exit cleanly exit code 128”. You can try any of the solutions you want as all are effective.

I hope you find it helpful!

Posted in Git

Leave a Reply

Your email address will not be published. Required fields are marked *