Wednesday, 29 July 2015

Git repository backup



Git is distributes system, the beauty of the git make is more robust and easy to recover from any last known good working copy.

However, You can not always rely on such copy and you will definitely need proper backup solution to deal with such situation.

There are many ways to take backup of git repositories.
I am listing few here.

  1. You can directly take a tar of the git repo directory as it has the whole bare contents of the repo on server. There is a slight possibility that somebody may be working on repo while taking backup.
  2. The following command will give you the bare clone of repo (just like it is in server), then you can take a tar of the location where you have cloned without any issue.
    git clone --bare {your backup local repo} {new location where you want to clone}