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?
Git, auto updating, security and tampering?
git
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 fetch. Usually you are working on a local respository, in which case you already have a full backup, so you don't need another repository that just keeps cloning it. Also instead of repeatedly running fetch, you can just use a normal backup routine to backup the whole repository folder. So you don't need to use git methods just to back it up.