62

I have: http://windows.github.com/

My current project has around 20k files, around 150MB (and not speaking about how slow it is and I cannot do a thing now) it doesn't even let me commit! I get this error: Commit failed: Failed to create a new commit.

That seems that nobody is having.

I've already deleted the folder and cloned again, no escape. What to do?

If I choose to open shell, all this *** crashes!


Edit:

Since the problem I've switched to Git Extensions and I didn't look back!

thanks for your answers

asherbret
  • 5,439
  • 4
  • 38
  • 58
Totty.js
  • 15,563
  • 31
  • 103
  • 175
  • Have you tried to contact GitHub Support? – MilkyWayJoe Jun 27 '12 at 15:38
  • no, I could do, but I'm not hoping for an answer in less than a week, that's why I made the question here.. – Totty.js Jun 27 '12 at 15:48
  • well, I contacted and they fixed some problems.. (quite fast) – Totty.js Sep 16 '12 at 23:17
  • @Totty: It would be nice to tell what they did, was it a bugfix? – CharlesB Sep 17 '12 at 11:25
  • the updates everybody is getting with github for win is what they have done. It's still very very very slow with a lot of files and sometimes it "misses" some files (maybe it's my problem, but it happened some times)... – Totty.js Sep 18 '12 at 21:04
  • Still happening with latest build as of today. – Air Nov 03 '12 at 18:53
  • I had this problem when I tried to commit some code that had a .git folder hidden inside it. – Andy Aug 27 '13 at 14:05
  • 2
    For future reference (and since this is the #1 result on Google for this error), GitHub support told me you can check `C:\Users\{user}\AppData\Local\GitHub\TheLog.txt` for potential errors, and contact them if it's not resolvable from there. – Seiyria Feb 12 '14 at 21:07

22 Answers22

77

This happened to me. Try opening up PowerShell and manually committing each file using the "git add [file name]" command. To see which files have been added, enter "git status" into the command line. The green files have been added, the red ones have not been added.

Once you've added them all, type "git commit." Then go back to Github for Windows and sync it up.

I'm not sure what causes this issue, but once I followed the above steps, Github went back to its normal, awesome behavior.

AER
  • 222
  • 3
  • 12
mpoulshock
  • 786
  • 6
  • 2
  • well they fixed the bug in +/- a week so it's no happening again. But thanks for your answer – Totty.js Jul 06 '12 at 12:51
  • Just had this happen to me, just did git add .\ and the res of your tip. Worked like a charm! – DatBassie Apr 24 '13 at 20:40
  • 25
    You can use `git add -A` to avoid manually doing each and every file. – Bart May 03 '13 at 04:21
  • 1
    Used `git add [file name]` in PowerShell and I got an actual message about the error (lock file). Why can't GitHub for Windows include that too? ... +1 – James Skemp Jun 29 '13 at 17:04
  • Also having any of said files open at the same time may not be productive to commiting... (My problem).. – RaenirSalazar Nov 25 '13 at 20:00
  • Needs some time to realize the dot behind `git commit.` . Do you need it? I used `git commit -m "My comment"` and it works. – Jan Hommes Aug 05 '14 at 17:04
33

I had this problem too after an unexpected crash. I couldn't fix using the 'Open Shell' option as suggested. I had to open the Windows CLI (Start -> run -> cmd) and delete the index.lock file in my GitHub folder:

cd \Users\myUser\my\local\github\repo
cd .git
del index.lock

Then when I went back to the GitHub app, it committed successfully.


Note that for some people, according to comments, the file to delete doesn't have the .lock extension, so the delete command could also be del index.

alexbt
  • 16,415
  • 6
  • 78
  • 87
underblob
  • 946
  • 9
  • 10
17

Im using Githug for Windows (7) and faced the same problem. While using PowerShell I realized that I didn't fill Full Name and email address in tools > options. Look like a beginner mistake (and I am!).

hope it helps!

Daniel Vitor
  • 171
  • 1
  • 4
  • Exactly - terrible design. They request for this extra configuration on top of the account and warn that "everyone will have access to this email" and "This will change your global gitconfig". And they don't bother to explain WHY, they may say "it is a required procedure for committing" and it would help. When I read it first time, I thought - why do I need to go through it, and cancelled the step... and end up looking for solution on this page :) – Yevgeniy Afanasyev May 11 '15 at 06:53
  • I'm voting +1 For the Githug typo :) – Johan Boulé Sep 14 '15 at 12:19
7

just try to commit a few from your updates. 5 for example. and then make another commit with all other updates.

Sorokin Andrey
  • 419
  • 5
  • 12
4

I am using windows client and getting the same error. Then suddenly I realized that my local db in app_data was opened on the SQL management. It just simply can't commit the some files to github if they are opened or using at the other programs.

Just disconnected management studio closed it and just simply committed.
This may be your case also. Check your files out!

gnat
  • 6,213
  • 108
  • 53
  • 73
osmancelik
  • 43
  • 4
  • not always.. sometimes I have my mongodb running and both works and not. Also when is not running. But the problem is ONLY in the nice win gui, not from the command line. – Totty.js Sep 20 '12 at 09:54
4

So guys this is the full steps I had to take in order to fix the problem...

1) Using Process Explorer (you can download it form here http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx) I searched for any process referencing ".git\index" and then I killed it.

2)Then using Git Shell (Windows Power Shell) I went into the repository which was giving me such difficulty and then furthermore went into its .git folder. (cd .\your_respository_name\.git). I then removed the index.lock file in that directory (rm -r index.lock).

3)Then from within that same directory I ran git reset HEAD.

4)Then I manually committed each file using the "git add [file_name]" comand. (You can check that they were added successfully if when you run git status, the files are green.

5)Next run git commit if your files are added correctly.

6)Finally go back to github for windows and sync everything up and it should hopefully work and resolve the problem.

Sabashan Ragavan
  • 728
  • 1
  • 5
  • 14
  • This worked for me aswell, when I ran the commit command in the shell it gave me the error: remove the index.lock. After I did this it could commit normally. I didn't have to add the files manually. – Richard Bos Aug 15 '13 at 13:26
3

This issue seems to be a bug in the github client - I get it "all the time" on the machine on which i only installed the github client. I Never saw it on the git + github PC (I have not used it for a few days now). Doing the "git add ." and then "git commit" worked for me also on the shell - but that is the thing the GUI should be doing not me - otherwise I can just stick to the git shell client.

Marc
  • 31
  • 1
2

Had the same problem, couldn't commit or sync using the windows GUI, but I could commit the changes through the shell. Once I'd added the changes through the shell the windows GUI started to sync normally. Hopefully it's a one off.

Scarel
  • 21
  • 2
2

I had an interesting issue - even though I had an excel file open called "Combined - ForImportv4.xlsm", Git UI had no problem checking that in but it gave the error in the OP's subject for the backup file "~$Combined - ForImportv4.xlsm" so I discarded that change and all went through.

PS: As for why i'm checking an Excel file into Git ... just don't got there :)...

nchaud
  • 377
  • 3
  • 13
2

I had this issue with the git windows desktop commit tool. I was getting this often and I figured out that Visual Studios was locking the files. To get around this issue I simply closed visual studio and the commit / sync worked fine.

2

I googled failed to create repository and ended up here.

My problem was that the description for my new repo was too long. There is a charlimit for the description, but GitHub tried to push it anyway and failed.

Navin
  • 3,681
  • 3
  • 28
  • 52
1

I just had the same problem, tried some of the suggestions on this post but none worked so what i did was, on the GiTHub client i went to tools -> settings and then click on the section where it says add/create default ignored files. Then hit Update and try to commit again through the client.

Komengem
  • 3,662
  • 7
  • 33
  • 57
1

It happend to me when my project was opened in an IDE (Netbeans in my case), make sure non of the files you're about to commit isn't open in some program.

eric.itzhak
  • 15,752
  • 26
  • 89
  • 142
1

I checked the log file at C:\Users{user}\AppData\Local\GitHub\TheLog.txt and found this error:

LibGit2Sharp.LibGit2SharpException:

Could not open 'SomePath\SomeProject.opensdf':

The process cannot access the file because it is being used by another process.

I closed Visual Studio and the commit was then created successfully. n.b. I removed actual file path in the above error.

1

If you are new user make sure that you have confirmed your e-mail. Had same problem and confirmation fixed it!

1

You can manually navigate to index.lock which is found inside the hidden .git folder of your repository location. Once you delete index.lock you will be able to commit as per usual.

The easiest way to navigate to the folder will be to click on the folder breadcrumbs inside windows explorer and add \.git and press enter.

1

Just delete 'index.lock' in the '/.git/' directory. Solved the problem for me instantly.

DualCore
  • 400
  • 1
  • 3
  • 15
0

I had this happen to me and this is the easiest way to fix it:

  1. Make a copy of your local folder that has the repo and remove the .git folder form it.
  2. Delete the original repo folder with files.
  3. Re-clone the repo from GitHub with the Windows client.
  4. Delete all of the files that get cloned except for the .git folder.
  5. Copy all files from the copied folder into the new clone folder.

Add in your commit notes and the commit should work this time.

Jason Rundell
  • 71
  • 1
  • 5
0

I had the same problem and I fixed it by renaming one of the file because its name was too long. This fixed the problem. Here is error message from git shell:

fatal: unable to stat 'plugins/com.napolitano.cordova.plugin.intent/example/app/platforms/android/CordovaLib/build/intermediates/classes/debug/org/apache/cordova/NativeToJsMessageQueue$OnlineEventsBridgeMode$OnlineEventsBridgeModeDelegate.class': Filename too long
Strabek
  • 2,391
  • 3
  • 32
  • 39
0

I REBOOTED my Windows 7 machine and tried again - IT WORKED!

I had the "Commit failed: Failed to create a new commit" and tried to delete the index or index.lock file via windows command prompt and that didn't work. I deleted it via windows explorer, that didn't work.

I tried to check credentials like another reply in this list said, but couldn't figure it out and the credentials seemed 'ok.' So - I rebooted. Viola.

I'm not sure this will help anyone, I'm not all that great w/ this stuff, but trying.

FloppyDisk
  • 97
  • 2
  • 9
0

I deleted ".git" in children directory and the problem was resolved.

0

It happened to me once ,I had a empty repository inside of the repository that I cloned. It was a silly mistake though but could happen .

Sameera De Silva
  • 1,722
  • 1
  • 22
  • 41