Git:停止 git push
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11729077/
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
Git: Stop git push
提问by Adam_G
I'm pushing a large file to git, but have a very slow connection. What is the safest way to terminate this push (mid-push), and resume it when I have a better connection?
我正在将一个大文件推送到 git,但连接速度很慢。终止此推送(中间推送)并在我有更好的连接时恢复它的最安全方法是什么?
回答by Greg Hewgill
Killing the client (Ctrl+Cor any other method) won't cause the data on the server to be corrupted, if that's what you mean by "safe". The server doesn't update anything until all the blobs are transferred successfully, then it updates the refs to point to the new blobs.
Ctrl+C如果这就是“安全”的意思,杀死客户端(或任何其他方法)不会导致服务器上的数据损坏。在所有 blob 成功传输之前,服务器不会更新任何内容,然后它会更新 refs 以指向新 blob。
Git doesn't have any facilities to resume an interrupted transfer though, so you'll probably have to transfer the big blob again when you have a faster connection.
不过,Git 没有任何设施来恢复中断的传输,因此当您有更快的连接时,您可能不得不再次传输大 blob。
回答by KevinH
I believe git push
is atomic, meaning that if you just Ctrl-C out of the operation, the remote repository will be in its original state, prior to the push. This also means that, when you do the push again, it will be starting over from the beginning. But it doesn't sound like that's necessarily a problem for you.
我相信git push
是原子的,这意味着如果您只是按 Ctrl-C 退出操作,则远程存储库将处于推送之前的原始状态。这也意味着,当您再次执行推送时,它将从头开始。但这听起来对你来说并不一定是个问题。