Continue an interrupted git-push (resume upload)

2020-02-25 23:05发布

问题:

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!

回答1:

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.



标签: git ssh