tags:

views:

83

answers:

2

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

A: 

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

Michael Mrozek
thanks a lot!and How to set my backup files become a new git server and keep the git log before?
Jackson
+1  A: 

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
VonC