125

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
  • 32,350
  • 30
  • 109
  • 146
ripper234
  • 222,824
  • 274
  • 634
  • 905
  • 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 Mar 10 '12 at 16:02
  • 1
    for me it was not working with tortoise git, but i got success with git bash simply. Try that – Noman Oct 27 '14 at 19:52
  • 11
    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 Mar 30 '15 at 09:56
  • In my case, I just type ```ssh-add``` in the terminal and start works. – lucianosousa Sep 03 '15 at 03:04
  • low disk space caused this issue to me – Mike Aug 15 '13 at 08:43
  • In my case changing config source from global to system helped. – Rohith K D Mar 22 '17 at 11:18
  • I know this is quite old, but i had the case with all remote opeartions via https. I figured out that i needed to rename libeay32.dll for testing a software project and forgot to revert that change. So if you have .dll errors/missing for the encryption part, you may also get this error without any further information. – Hugie May 29 '18 at 09:14
  • In my case, the destination path where the project is cloning is "long". I tried changing the destination path to a smaller path in length, It works. Sometimes the error is not able to create the file in our local machine due to the destination path length is too long, try changing it to simple path. – Bala Subramanyam Nov 03 '21 at 15:18
  • the problem on my end, the paths were too long. Once they were shortened, it worked. – Ryan Schultz Feb 26 '22 at 17:12
  • other reason could be the name of repository doesn`t exist anymore – jaitor Jul 13 '22 at 20:59

17 Answers17

53

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

dimo414
  • 47,227
  • 18
  • 148
  • 244
gaz
  • 618
  • 5
  • 2
  • 13
    It doesn't mean the key was compromised ... github invalidated all keys when they were hacked a few weeks ago. – ripper234 Apr 02 '12 at 16:54
  • 2
    For creating new SSH key. Refer to https://help.github.com/articles/generating-ssh-keys/ – emeraldhieu Dec 04 '14 at 04:42
  • 16
    FYI, this answer is no longer valid, because exit code `128` can mean a lot of things, and isn't specific to SSH. – jefflunt Jul 12 '19 at 03:24
  • 1
    @jefflunt I agree with you! exit code 128 means a lot of things. In my case, the destination path where the project is cloning is "long". I tried changing the destination path to a smaller path in length, It works. Sometime the error is not able to create the file in our local machine due to the destination path length is too long. – Bala Subramanyam Nov 03 '21 at 15:17
43

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"
Benjamin Kaiser
  • 2,177
  • 22
  • 24
12

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
  • 1,152
  • 1
  • 23
  • 41
user416456
  • 131
  • 3
11

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
  • 533
  • 9
  • 29
dezirus
  • 119
  • 1
  • 2
  • This worked for me after I aborted a commit after realizing I'd missed a file. Deleting it allowed me to commit and push again. – Robert Went Nov 20 '16 at 17:36
7

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

Benny
  • 109
  • 1
  • 6
6

Deleting index.lock worked for me

m0r6aN
  • 850
  • 1
  • 11
  • 19
4

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.

opto
  • 41
  • 1
3

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.

Cesar
  • 2,059
  • 25
  • 30
1

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)

Erik Bergstedt
  • 912
  • 10
  • 27
1

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

1

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.

user2062360
  • 1,323
  • 5
  • 16
  • 29
1

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.

roadrunner
  • 29
  • 2
1

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

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.

sajin tm
  • 323
  • 3
  • 9
0

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.

uSer
  • 23
  • 6
  • Please don't add "thank you" as an answer. Instead, vote up the answers that you find helpful. - [From Review](/review/late-answers/33366319) – Simas Joneliunas Dec 14 '22 at 01:13
0

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

fatherOfWine
  • 1,191
  • 16
  • 39
0

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
Suban Dhyako
  • 2,436
  • 4
  • 16
  • 38