Git ошибка 128

I’ve run into this serious error while committing, and created a bug report.

I keep getting this error on TortoiseGit operations:

git did not exit cleanly (exit code 128)

I’ve reinstalled the program, rebooted, and tried to clone a fresh repo from github — nothing seems to work. I also deleted %appdata%\Tortoise git folder … I’m at a loss now. Any advice on how to proceed?

MrTux's user avatar

MrTux

32.5k30 gold badges110 silver badges148 bronze badges

asked Mar 8, 2012 at 12:01

ripper234's user avatar

ripper234ripper234

223k276 gold badges635 silver badges905 bronze badges

10

It’s probably because your SSH key has been removed/revoked. Make a new one and add it to your GitHub account.

dimo414's user avatar

dimo414

47.3k18 gold badges148 silver badges245 bronze badges

answered Apr 2, 2012 at 16:50

gaz's user avatar

4

for me I simply had to add configure my git username and email with the following commands:

git config --global user.email "you@example.com"
git config --global user.name "Your Name"

answered Jun 21, 2013 at 5:38

Benjamin Kaiser's user avatar

4

If you’re running windows 7:

I was trying to decide the best way to do this securely, but the lazy way is :

  1. right-click the parent folder
  2. click the «properties» button
  3. click the «security» tab
  4. click the «edit» button
  5. click the group that starts with «Users»
  6. click the checkbox that says «full control»
  7. click all the OK’s to close the dialogs.

I realize this might circumvent windows «security» features, but it gets the job done.

Alicia's user avatar

Alicia

1,1521 gold badge24 silver badges41 bronze badges

answered Mar 9, 2012 at 15:58

user416456's user avatar

1

git-bash reports
fatal: Unable to create <Path to git repo>/.git/index.lock: File exists.

Deleting index.lock makes the error go away.

sandip's user avatar

sandip

5359 silver badges29 bronze badges

answered Jan 25, 2013 at 18:22

dezirus's user avatar

dezirusdezirus

1191 silver badge2 bronze badges

1

In my case a folder in my directory named as the git-repository on the server caused the failure.

answered Oct 23, 2012 at 12:48

Benny's user avatar

BennyBenny

1091 silver badge6 bronze badges

1

Deleting index.lock worked for me

answered Nov 22, 2013 at 18:34

m0r6aN's user avatar

m0r6aNm0r6aN

8501 gold badge11 silver badges19 bronze badges

1

on win7 64:

git-gui gives a good answer: a previous git has crashed and left a lock file. Manually remove.
In my case, this was in .git/ref/heads/branchname.lock.

delete, and error 128 goes away. It surprises that tortoisegit doesn’t give such an easy explanation.

answered Jan 6, 2013 at 12:10

opto's user avatar

In my case, it was because of the proxy. A proxy was needed in the corporate network and TortoiseGit / Git does not seems to automatically get information from Windows internet settings. Setting up the proxy address solved the issue.

answered Nov 12, 2013 at 15:13

Cesar's user avatar

CesarCesar

2,05925 silver badges30 bronze badges

For me, I tried to check out a SVN-project with TortoiseGit. It worked fine if I used TortoiseSVN though. (May seem obvious, but newcomers may stumble on this one)

answered Dec 2, 2012 at 7:32

Erik Bergstedt's user avatar

In my case, I forgot to add git to the respository name at the end.

answered Mar 20, 2013 at 13:45

Manasi Diwan's user avatar

I did git revert a multiple times ,and it worked for me make sure un-check the files while reverting you need changes. Stash your changes and pull again.

answered Apr 22, 2013 at 21:37

user2062360's user avatar

user2062360user2062360

1,3435 gold badges16 silver badges30 bronze badges

I was having this same issue and I resolved it in the following way…

I have the NVIDIA «Tegra Android Development Pack» installed and it seems to also have a version of mysysgit.exe with it. TortoiseGit automatically found that installation location (instead of the standard git installation) and auto-populated it in the settings menu.

To correct this, go to: «Settings -> General» and there is a field for the path to mysysgit.exe. Make sure this is pointing to the correct installation.

answered Sep 5, 2013 at 14:18

roadrunner's user avatar

An quick solution would be to create a new local directory for example c:\git_2014, In this directory rightklick and choose Git Clone

answered Jan 7, 2014 at 8:26

Roel van Roozendaal's user avatar

make sure the username and email fields are not empty in the config file. and try to clone to an empty directory. these steps worked for me.

answered Aug 15, 2013 at 9:54

sajin tm's user avatar

sajin tmsajin tm

3233 silver badges9 bronze badges

although, it is a very old thread, recently I got this error, and in my case, the link was broken. When the link to GitHub was fixed, it worked.

answered Dec 8, 2022 at 1:30

uSer's user avatar

uSeruSer

236 bronze badges

1

What has worked for me:
Removing all offending branch related files from all folders in .git\ref and .git\logs

answered Jan 20 at 13:08

fatherOfWine's user avatar

fatherOfWinefatherOfWine

1,19116 silver badges39 bronze badges

I got this error while trying to pull/fetch code from Bitbucket repo because my internet connection was not working.

Make sure your internet connection is working properly

answered Apr 21 at 10:55

Suban Dhyako's user avatar

Suban DhyakoSuban Dhyako

2,4364 gold badges16 silver badges38 bronze badges

Asked

Viewed
53k times

What is git-remote-http error code 128. It happened when I tried to pust to a repo that needed authentication (it never asked for a password.) Is there some central place to find out what error codes mean?

asked Jun 21, 2013 at 21:38

PyRulez's user avatar

3

128 is a default fatal error code. It doesn’t mean it’s necessarily something to do with authentication.

That means you have to read the error message.

See the source code, and git documentation.

answered Oct 19, 2021 at 13:30

Stefano's user avatar

StefanoStefano

1,7061 gold badge16 silver badges25 bronze badges

If you talk of the command return code, it means that the key has been revoked.

You can find the existing codes here for example: http://mazack.org/unix/errno.php

answered Mar 28, 2019 at 15:36

padawin's user avatar

padawinpadawin

4,23815 silver badges19 bronze badges

1

it’s probably because your SSH key has been compromised. Make a new one and add it to your GitHub account.

answered May 2, 2014 at 14:30

user3590011's user avatar

0

I’ve run into this serious error while committing, and created a bug report.

I keep getting this error on TortoiseGit operations:

git did not exit cleanly (exit code 128)

I’ve reinstalled the program, rebooted, and tried to clone a fresh repo from github — nothing seems to work. I also deleted %appdata%\Tortoise git folder … I’m at a loss now. Any advice on how to proceed?

MrTux's user avatar

MrTux

32.5k30 gold badges110 silver badges148 bronze badges

asked Mar 8, 2012 at 12:01

ripper234's user avatar

ripper234ripper234

223k276 gold badges635 silver badges905 bronze badges

10

It’s probably because your SSH key has been removed/revoked. Make a new one and add it to your GitHub account.

dimo414's user avatar

dimo414

47.3k18 gold badges148 silver badges245 bronze badges

answered Apr 2, 2012 at 16:50

gaz's user avatar

4

for me I simply had to add configure my git username and email with the following commands:

git config --global user.email "you@example.com"
git config --global user.name "Your Name"

answered Jun 21, 2013 at 5:38

Benjamin Kaiser's user avatar

4

If you’re running windows 7:

I was trying to decide the best way to do this securely, but the lazy way is :

  1. right-click the parent folder
  2. click the «properties» button
  3. click the «security» tab
  4. click the «edit» button
  5. click the group that starts with «Users»
  6. click the checkbox that says «full control»
  7. click all the OK’s to close the dialogs.

I realize this might circumvent windows «security» features, but it gets the job done.

Alicia's user avatar

Alicia

1,1521 gold badge24 silver badges41 bronze badges

answered Mar 9, 2012 at 15:58

user416456's user avatar

1

git-bash reports
fatal: Unable to create <Path to git repo>/.git/index.lock: File exists.

Deleting index.lock makes the error go away.

sandip's user avatar

sandip

5359 silver badges29 bronze badges

answered Jan 25, 2013 at 18:22

dezirus's user avatar

dezirusdezirus

1191 silver badge2 bronze badges

1

In my case a folder in my directory named as the git-repository on the server caused the failure.

answered Oct 23, 2012 at 12:48

Benny's user avatar

BennyBenny

1091 silver badge6 bronze badges

1

Deleting index.lock worked for me

answered Nov 22, 2013 at 18:34

m0r6aN's user avatar

m0r6aNm0r6aN

8501 gold badge11 silver badges19 bronze badges

1

on win7 64:

git-gui gives a good answer: a previous git has crashed and left a lock file. Manually remove.
In my case, this was in .git/ref/heads/branchname.lock.

delete, and error 128 goes away. It surprises that tortoisegit doesn’t give such an easy explanation.

answered Jan 6, 2013 at 12:10

opto's user avatar

In my case, it was because of the proxy. A proxy was needed in the corporate network and TortoiseGit / Git does not seems to automatically get information from Windows internet settings. Setting up the proxy address solved the issue.

answered Nov 12, 2013 at 15:13

Cesar's user avatar

CesarCesar

2,05925 silver badges30 bronze badges

For me, I tried to check out a SVN-project with TortoiseGit. It worked fine if I used TortoiseSVN though. (May seem obvious, but newcomers may stumble on this one)

answered Dec 2, 2012 at 7:32

Erik Bergstedt's user avatar

In my case, I forgot to add git to the respository name at the end.

answered Mar 20, 2013 at 13:45

Manasi Diwan's user avatar

I did git revert a multiple times ,and it worked for me make sure un-check the files while reverting you need changes. Stash your changes and pull again.

answered Apr 22, 2013 at 21:37

user2062360's user avatar

user2062360user2062360

1,3435 gold badges16 silver badges30 bronze badges

I was having this same issue and I resolved it in the following way…

I have the NVIDIA «Tegra Android Development Pack» installed and it seems to also have a version of mysysgit.exe with it. TortoiseGit automatically found that installation location (instead of the standard git installation) and auto-populated it in the settings menu.

To correct this, go to: «Settings -> General» and there is a field for the path to mysysgit.exe. Make sure this is pointing to the correct installation.

answered Sep 5, 2013 at 14:18

roadrunner's user avatar

An quick solution would be to create a new local directory for example c:\git_2014, In this directory rightklick and choose Git Clone

answered Jan 7, 2014 at 8:26

Roel van Roozendaal's user avatar

make sure the username and email fields are not empty in the config file. and try to clone to an empty directory. these steps worked for me.

answered Aug 15, 2013 at 9:54

sajin tm's user avatar

sajin tmsajin tm

3233 silver badges9 bronze badges

although, it is a very old thread, recently I got this error, and in my case, the link was broken. When the link to GitHub was fixed, it worked.

answered Dec 8, 2022 at 1:30

uSer's user avatar

uSeruSer

236 bronze badges

1

What has worked for me:
Removing all offending branch related files from all folders in .git\ref and .git\logs

answered Jan 20 at 13:08

fatherOfWine's user avatar

fatherOfWinefatherOfWine

1,19116 silver badges39 bronze badges

I got this error while trying to pull/fetch code from Bitbucket repo because my internet connection was not working.

Make sure your internet connection is working properly

answered Apr 21 at 10:55

Suban Dhyako's user avatar

Suban DhyakoSuban Dhyako

2,4364 gold badges16 silver badges38 bronze badges

Git is a powerful version control system used by software developers to manage their codebase.

TortoiseGit is a popular GUI client for Git that makes it easy to use Git on Windows.

However, sometimes TortoiseGit users may encounter the error “Git did not exit cleanly (exit code 128)” when trying to commit or push changes to their repository.

This error can be frustrating, but it is usually easy to fix.


What Causes the Git Did Not Exit Cleanly Exit Code 128 Error?

This error usually occurs when TortoiseGit encounters an issue while trying to access the Git index.

The Git index is a binary file that tracks changes to the repository.

When TortoiseGit is unable to access the index, it displays the error “Git did not exit cleanly (exit code 128)”.

The most common causes of this error include:

  • A corrupted Git index
  • An unfinished merge operation
  • A conflict between the local repository and the remote repository
  • A Git lock file that is not released

There are several solutions to this problem, depending on the cause of the error.

Here are some steps to try:

Remove the corrupted Git index

If the Git index is corrupted, you can remove it and then run the “git reset” command to recreate it.

To do this, follow these steps:

  • Open the Git repository in Windows Explorer
  • Go to the “.git” folder and delete the “index” file
  • Open the Git Bash or Command Prompt and navigate to the repository
  • Run the following command:
git reset

Finish the merge operation

If you were in the middle of a merge operation when the error occurred, you can finish the merge by running the “git merge –abort” command.

git merge --abort

Resolve the conflict between the local and remote repository

If there is a conflict between the local repository and the remote repository, you will need to resolve the conflict before you can commit and push your changes.

To do this, follow these steps:

  • Pull the latest changes from the remote repository
  • Open the files that have conflicts and resolve them
  • Commit the resolved conflicts
  • Push the changes to the remote repository

Release the Git lock file

If the Git lock file is not released, you can remove it manually to resolve the error.

To do this, follow these steps:

  • Open the Git repository in Windows Explorer
  • Go to the “.git” folder and delete the “index.lock” file

Conclusion

The “Git did not exit cleanly (exit code 128)” error can be frustrating, but it is usually easy to resolve.

By trying the solutions listed above, you should be able to get TortoiseGit working again.

If you continue to have issues, you can always consult the TortoiseGit documentation or reach out to the TortoiseGit community for help.

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 😎.

git did not exit cleanly exit code 128

Page content

  1. Fix #1 — Configure your email and username
  2. Fix #2 — Add your SSH key to your Git service
  3. Fix #3 — Remove the Git lock file
  4. Final thoughts

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.

git did not exit cleanly exit code 128

Here are some other Git tutorials for you to enjoy:

  • How to fix the «unlink of file failed» error in Git?
  • How to fix the «git add» command not working?
  • How to fix the «unable to update local ref» error in Git?
  • How to recursively add a folder in Git?

Tim Mouskhelichvili

written by:

Hello! I am Tim Mouskhelichvili, a Freelance Developer & Consultant from Montreal, Canada.

I specialize in React, Node.js & TypeScript application development.

If you need help on a project, please reach out, and let’s work together.

Понравилась статья? Поделить с друзьями:
  • Git push u origin master выдает ошибку
  • Git push u origin main ошибка
  • Git clone ошибка авторизации
  • Git add ошибка
  • Git 503 ошибка