I was thinking about hosting my private project on my server (i may use 'gitolite') and have a copy on my local machine as backup (git clone then automated git fetch every few minute). I want to know what happens if there is a bug gitolite or somewhere else on my server and the source code and git repository has been tampered with? Will my backup also be corrupted? will i easily be able to revert the source using the history?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
Git maintains its integrity quite well. If you know the SHA-1 of the HEAD, and you usually do that if you have a local copy, then you can be totally sure that the whole tree of that commit is unaltered. So when the server's version is corrupted, for what reason ever, you will easily notice that when you try to interact with it again. Either you will pull wrong revisions, in which case you can simply ignore or remove them, or you will push the correct versions again, which automatically restores the remote repository. There is no real way to corrupt your local version as well, as long as you use git's methods to update each repository.
However, I don't really get why you want to backup the repository via
Backup the folder that the project is in (its 'root') which includes the .git directory tree of files that are the contents of git.
Backing up 'outside' of git is a good idea - although be aware that after any add or change it's out of date, as in the nature of daily backups.