How to fix the "git did not exit cleanly exit code 128" error?
Sometimes, when running a Git command, you get the "git did not exit cleanly exit code 128" error. But what is this error, and how do you fix it?
This article shows different methods that will help you fix this error.
Let's get to it 😎.
The "git did not exit cleanly exit code 128" error can happen for a few different reasons.
Here are some of them:
- Your SSH key is invalid.
- Your Git configuration is invalid.
- Something is wrong with the git lock file.
To fix this error, go down this list of potential fixes until you find the one that solves your issue.
Fix #1 - Configure your email and username
To fix this error, you first need to configure your Git email and username, like so:
bashgit config --global user.email "you@example.com"
git config --global user.name "Your Name"
Then, re-run the command that gave you the error.
Fix #2 - Add your SSH key to your Git service
Another reason this error may occur is that your SSH key is revoked or invalid.
To fix this error, create a new key and add it to your Git service account (aka Github, GitLab, Bitbucket, etc.)
Fix #3 - Remove the Git lock file
This error may also occur because something is wrong with the Git index.lock file.
To fix this error, you need to manually remove the index.lock file located at <path>/.git/index.lock.
Final thoughts
As you can see, fixing the "git did not exit cleanly exit code 128" error is easy.
Most of the time, you simply need to remove the index.lock file.
Here are some other Git tutorials for you to enjoy: