继续中断的 git-push(恢复上传)
所以我正在做这个相当大的 git-push,大约 2 GB 的数据被推送到我的服务器。突然我的 wifi 连接断了。因此,现在在通过慢速连接传输了超过 250 MB 数据后,我必须重新开始,只是冒着整个事情的风险。
[/rant]
当对 SSH 远程进行 git-push 时,有没有办法在失败后继续传输?
如果没有,通过不稳定连接传输存储库同时避免上传所有文件的最佳方法是什么?
谢谢!
So I'm doing this pretty huge git-push, about 2 GB of data being pushed to my server. Suddenly my wifi connection dies. So now after transferring over 250 MB over my slow connection, I have to start again, just to risk the whole thing all over.
[/rant]
When doing a git-push to an SSH remote, is there any way to continue the transfer after it failed?
If not, what's the best way to transfer the repository over a flaky connection, while avoiding to have to upload all of the files?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将存储库的 .git 目录同步到服务器上的新目录,例如 newdir/.git 。然后 ssh 到该服务器并在您拥有的任何分支上执行 git checkout。然后添加您最初想要推送到的本地存储库作为远程并执行本地推送。
由于 rsync 不受网络中断的影响,因此无论何时发生这种情况,您都应该能够继续。
rsync your .git directory of your repo to a new directory, say newdir/.git on your server. Then ssh to that server and do a git checkout on any of the branches you have. Then add the local repo that you wanted to push to originally as a remote and do a local push.
As rsync is immune to network interruption you should be able to continue whenever that happens.