Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to backup git server?

Tags:

git

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

like image 425
Jackson Avatar asked May 20 '10 01:05

Jackson


2 Answers

You can use:

git bundle

That way:

  • you have only one file to move to a backup server
  • you actually can use this file as an "origin" repo from which you can pull/push data like a regular Git repo.

You will for the first backup create a full bundle:

$ git bundle create /tmp/foo-all --all
like image 127
VonC Avatar answered Nov 01 '22 03:11

VonC


You back it up like any other server, just mirror the files; git stores its metadata in files like anything else. If you move the repository to a new machine, you need to change your local repository's origin to point to it. In .git/config you'll find something like:

[remote "origin"]
url = SOMETHING

Change SOMETHING to the address of your new server

like image 33
Michael Mrozek Avatar answered Nov 01 '22 04:11

Michael Mrozek