意外挂断后如何恢复 git pull/clone?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14738219/
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
How to resume a git pull/clone after a hung up unexpectedly?
提问by Javier Cadiz
I do a git pull/clone to some repository (mainly github ones). Sometimes after a few minutes the download crashes.
我对某个存储库(主要是 github 存储库)执行了 git pull/clone 操作。有时几分钟后下载会崩溃。
Here is a log.
这是一个日志。
remote: Counting objects: 2284, done.
remote: Compressing objects: 100% (713/713), done.
fatal: The remote end hung up unexpectedlyiB | 5 KiB/s
fatal: early EOF
fatal: index-pack failed
In my following of the process, i have noticed that i have already fetched about 4 MBs of objects. When i start the process again, it starts from the beginning. My Internet connection sucks, some times it crashes and i get disconnected unexpectedly.
在我对过程的跟踪中,我注意到我已经获取了大约 4 MB 的对象。当我再次开始这个过程时,它从头开始。我的互联网连接很糟糕,有时它会崩溃并且我意外断开连接。
My question is: Is there any way to resume the pull/clone to rescue those 4 MBs i have already fetched, and not to start again?
我的问题是:有什么方法可以恢复拉/克隆来拯救我已经获取的那 4 MB,而不是重新开始?
采纳答案by bpoiss
If a pull hung up, it will not write any changes to your filesystem. This is because, if it would, your local repository would not be in a stable state.
如果 pull 挂了,它不会向你的文件系统写入任何更改。这是因为,如果是这样,您的本地存储库将不会处于稳定状态。
There is no way to resume a pull/clone. So your only choice is to pull/clone again.
有没有办法恢复拉/克隆。所以你唯一的选择是再次拉/克隆。
回答by Storm
cd into the the main directory and run
cd 进入主目录并运行
git fetch
tested only on linux
仅在 linux 上测试