Suppose we have just lost a remote repository, because someone accidentally typed the following command.
rm -rf OurRepo.git
In order to restore it, we plan to use one of the top-voted answers to an earlier question.
However, I observed that none of the solutions mentions the following three-step strategy.
- Use git init --bareto recreate the remote repository.
- Set the new remote git remote add origin <new repository URL>.
- Use git push origin masterfrom one of the machines that has an up-to-date copy of the repo
I have tried this on a toy respository and it appears to work, but one of my colleagues claims there is a problem with it without being able to pinpoint why.
Can anyone either confirm or deny whether this is a reasonable way to restore a lost remote?
 
    