Git Clone Exit Status 128

In some cases, you might encounter the “git clone did not exit cleanly exit code 128” error when running the “git clone” command or any other related Git subcommand. This can be difficult to troubleshoot as the error message is not explicit and hence not easy to track down.

However, in this post, we will attempt to provide a much better context about this error, what it is, why it occurs, and how you can attempt to fix it.

What Does It Mean?

One difficult issue with this error is that it is vague and hence no actual root cause of the problem. However, the exit code 128 means that Git has encountered a “fata” error that has caused it to exit unsuccessfully.

The main reason as to why this error occurs depends on the subcommand that you run. For example, it can involve network issues, permission denied, authentication issues, etc.

However, the following are the three main reasons as to why this error might occur when running the “git clone” command:

  1. Invalid Configuration
  2. Missing or Invalid SSH Key
  3. Issues with the lock file

Let us explore the various methods that you can use to fix this problem.

Method 1: Invalid Configuration

The most common method of fixing this issue is reconfiguring the details of Git. You can do this using the “git config” as follows:

git config --global ""
git config --global "username"

Replace the email address and the username values to match your credentials. Once you reconfigured the details, proceed to re-run the command to see whether you have the error resolved.

Method 2: Missing or Invalid SSH Key

Another reason why this error occurs is when your SSH key is revoked or invalid.

To fix this error, you should create a new key and add it to your Git service account (such as GitHub).

Method 3: Issues with the Lock File

Git has a lock file that prevents the concurrent access and modifications to the Git index. This is also known as the staging area or cache. Once you run a command such as “git add”, Git creates this file to show that there is a currently running process that is locking the changes to the index.

You can think of it like a mutex; it basically prevents multiple Git processes or users to modify the Git index simultaneously as it can lead to data corruption.

When a Git command starts, it checks for the presence of this lock file. If the file exists, it means that another process is already working with the index, and the current command waits until the lock is released.

Once the Git command completes its operation on the index, it removes the “index.lock” file which signals that the index is available for other operations.

If there is an issue with the lock file, it can lead to the Git commands failing with the exit status 128. You can fix it by removing the file.

$ rm -rf path/to/repo/.git/index.lock

This should delete the lock file of the repo and you can proceed to re-run your command.


In this tutorial, we covered what causes the “git exit status 128” when running the Git commands, the potential causes, and its solutions.

About the author

John Otieno

My name is John and am a fellow geek like you. I am passionate about all things computers from Hardware, Operating systems to Programming. My dream is to share my knowledge with the world and help out fellow geeks. Follow my content by subscribing to LinuxHint mailing list