How to restore Git after fatal file system error?

前端 未结 3 683
眼角桃花
眼角桃花 2021-01-14 18:31

What is the fastest path to restore a git repository after a file system error on the main server?

Imagine the central server of your OSS project fails and all commi

3条回答
  •  情深已故
    2021-01-14 18:54

    I think it might be better to create a new repo on the server:

    % ssh user@server
    % mv /path/to/repo /path/to/repo.old
    % mkdir /path/to/repo
    % cd /path/to/repo
    % git init --bare
    

    Then push from all the different clones that you have. My thinking is that this would avoid any corrupt files that may be in the old repo, and there should be no loss at all, provided you all work on your own clones, and noone is messing around in the server repo.

提交回复
热议问题