106
votes

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?

14
Is that the only error you're getting? Usually you see this error with other error messages. It could mean so many things, from local configuration problems to server configs. - SinisterRainbow
low disk space caused this issue to me - Mike
for me it was not working with tortoise git, but i got success with git bash simply. Try that - Noman
I voted to reopen. There might be many answers possible for this question, but from a user point of view, there is nothing more that can be provided as the OP has done. The range of possible answers does not stem from what the OP is asking but how the return code 128 is used by git. - SpaceTrucker
In my case, I just type ssh-add in the terminal and start works. - lucianosousa

14 Answers

44
votes

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

35
votes

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

git config --global user.email "[email protected]"
git config --global user.name "Your Name"
10
votes

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

Deleting index.lock makes the error go away.

10
votes

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.

6
votes

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

5
votes

Deleting index.lock worked for me

4
votes

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.

3
votes

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.

1
votes

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)

1
votes

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

1
votes

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.

1
votes

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.

1
votes

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

0
votes

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.