暂停 git clone 并稍后恢复?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7805274/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 12:05:36  来源:igfitidea点击:

pause git clone and resume later?

gitgit-clone

提问by ???

Is there a way to pause git clone and resume it later? I'm cloning a really big repo (around 2GB) and my PC's been turned on for more than 40 hours. I have school to catch later, I don't want to leave it like this. Anybody got an idea? It's already at 67% btw. :(

有没有办法暂停 git clone 并在以后恢复它?我正在克隆一个非常大的存储库(大约 2GB)并且我的 PC 已经打开了 40 多个小时。以后还有学校要赶,我不想就这样离开。有人有想法吗?顺便说一句,它已经达到了 67%。:(

采纳答案by Mark Longair

Assuming it's a normal git clone, I'm afraid that they're not resumable, as far as I know. To add support for resumable git clone/ git fetchhas been a suggested project for the Google Summer of Code in the past.

假设这是正常的git clone,据我所知,恐怕它们是不可恢复的。添加对可恢复git clone/git fetch过去的支持一直是 Google Summer of Code 的一个建议项目。

One exception is if you're actually doing a git svn clone, then you can restart it by changing into the directory and running git svn fetch, but I assume that this is just a normal git repository you're cloning. For some other ideas of how to work around this, you might want to try the suggestions in the answers to this question:

一个例外是,如果您实际上正在执行git svn clone,那么您可以通过更改目录并运行来重新启动它git svn fetch,但我认为这只是您正在克隆的普通 git 存储库。有关如何解决此问题的其他一些想法,您可能想尝试此问题的答案中的建议:

回答by Jared

Depending on your situation (e.g. if you want to close your laptop and / or switch networks), stopping the process (using Ctrl-Z) and resuming it (using fg) might work for you.

根据您的情况(例如,如果您想关闭笔记本电脑和/或切换网络),停止进程(使用Ctrl-Z)并恢复它(使用fg)可能对您有用。