How to backup git server?

How to backup git server? When a git server is corrupted, how can I push my local repository to a new git server?

+6
git
source share
2 answers

You can use:

git bundle

Thus:

  • you have only one file to go to the backup server
  • In fact, you can use this file as a “source” repo from which you can pull / forward data like a regular Git repository.

For the first backup, create a complete set:

 $ git bundle create /tmp/foo-all --all 
+8
source share

You support it, like any other server, just mirror the files; git stores metadata in files, like everything else. If you move the repository to a new computer, you need to change the location of the local repository to point to it. In .git/config you will find something like:

 [remote "origin"] url = SOMETHING 

Change SOMETHING to the address of your new server

+2
source share

All Articles