git Github windows:提交失败:无法创建新提交...继续问题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17005677/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Github windows: Commit failed: Failed to create a new commit... continued issues
提问by Sabashan Ragavan
So it appears that I have the exact same problem as the individual who asked this question...
所以看起来我和问这个问题的人有完全相同的问题......
Github windows: Commit failed: Failed to create a new commit
I followed the steps suggested in the top voted answer yet it did not fix my problem. I then did what the third top ranked answer suggested...removing the index.lock file form the .git folder...yet this did not resolve the problem either as it seems that the index.lock file keeps getting regenerated when I try to commit again.
我遵循了最高投票答案中建议的步骤,但它并没有解决我的问题。然后我做了排名第三的答案所建议的......从 .git 文件夹中删除 index.lock 文件......但这并没有解决问题,因为当我尝试时,index.lock 文件似乎不断重新生成再次提交。
Anyone have any suggestions?
有人有什么建议吗?
Thanks in advance!
提前致谢!
Ok so I've come to a realization that some process has a lock on the .git\index file...after reading this indivual's post... Git rename from index.lock to index failed…... how would I find out what this process is?
好的,所以我意识到某些进程锁定了 .git\index 文件...阅读此人的帖子后... Git 从 index.lock 重命名为 index 失败.... 我怎么找到出来这个过程是什么?
I can then kill that process and continue
然后我可以终止该进程并继续
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.
1)使用进程资源管理器(你可以从这里下载它http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx)我搜索了任何引用“.git\index”的进程,然后我杀死了它。
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).
2)然后使用 Git Shell(Windows Power Shell)我进入了给我带来如此困难的存储库,然后进一步进入了它的 .git 文件夹。(cd .\your_respository_name.git)。然后我删除了该目录中的 index.lock 文件 (rm -r index.lock)。
3)Then from within that same directory I ran git reset HEAD.
3)然后从同一个目录中我运行 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.
4)然后我使用“git add [file_name]”命令手动提交每个文件。(如果运行 git status 时文件是绿色的,则可以检查它们是否已成功添加。
5)Next run git commit if your files are added correctly.
5)如果你的文件添加正确,接下来运行 git commit 。
6)Finally go back to github for windows and sync everything up and it should hopefully work and resolve the problem.
6)最后回到 github for windows 并同步所有内容,希望它可以工作并解决问题。
回答by Sabashan Ragavan
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.
1)使用进程资源管理器(你可以从这里下载它http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx)我搜索了任何引用“.git\index”的进程,然后我杀死了它。
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).
2)然后使用 Git Shell(Windows Power Shell)我进入了给我带来如此困难的存储库,然后进一步进入了它的 .git 文件夹。(cd .\your_respository_name\.git)。然后我删除了该目录中的 index.lock 文件 (rm -r index.lock)。
3)Then from within that same directory I ran git reset HEAD.
3)然后从同一个目录中我运行 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.
4)然后我使用“git add [file_name]”命令手动提交每个文件。(如果运行 git status 时文件是绿色的,则可以检查它们是否已成功添加。
5)Next run git commit if your files are added correctly.
5)如果你的文件添加正确,接下来运行 git commit 。
6)Finally go back to github for windows and sync everything up and it should hopefully work and resolve the problem.
6)最后回到 github for windows 并同步所有内容,希望它可以工作并解决问题。
回答by VonC
If you have a process blocking (keeping an handle) on a git resource, you can track it using process explorer.
如果您在 git 资源上有一个进程阻塞(保留一个句柄),您可以使用process explorer跟踪它。
Search for any processreferencing ".git\index
" and you will be able to kill it.
搜索任何引用“ .git\index
”的进程,您就可以杀死它。
回答by onurhb
- Install winrar if you don't have it
- Go to your repository folder
- Open the .git folder
- Delete index.lock
- Did it work?
- 如果没有安装 winrar
- 转到您的存储库文件夹
- 打开 .git 文件夹
- 删除 index.lock
- 它起作用了吗?
回答by Mr.K
Error Message: commit failed - exit code 1 received
错误消息:提交失败 - 收到退出代码 1
Solution:
解决方案:
- Open your repository folder.
- Delete .gitfolder from your repository folder.
- Retry to
commit
andpush
.
- 打开您的存储库文件夹。
- 从您的存储库文件夹中删除.git文件夹。
- 重试
commit
和push
。