I'm taking some svn repositories into the git. So, what I basically try to do is:
- Set up a server with the best GIT repository, from which I will pull and push
- Setup some backup server for all 1 My repository on server 1
So, suppose I have a directory on my server, such as: $ HOME / git / , which has bare repositories example:
~ / git / project1.git ~ / git / project2.git ~ / git / project3.git ... My backup server mirrors on this server Can keep backup data in archives, or whatever I think I can do something like this:
git clone - equal ssh: // gitserver / ~ user / git /projectX.git Or maybe:
$ cd ~ / git / project1.git $ git bundle Create ~ / gitbackup / project1.bdl --all and then copy all bundles from all projects to your backup server.
However, many projects either strategy will be very difficult, so in each case I will need to automate some scripts to work.
I wonder how are you guys doing this? Maybe there is a better way to do that I have already accepted. Any tip will be appreciated.
The general idea would be:
- Bare repo on your backup server
- Your main plum is on GIT repository (probably A), which will automatically push anything that is received in the respective GET backup repo. Other techniques based on
, but this idea is similar.
Example of a post receiving hook:
- From:
#! / Bin / sh # # A hook script that is called after successful # committed # # Place this file in .git / hooks and chmod + x BRANCH = 'git branch --no-color 2> / dev / null | Sed -e '/ ^ [^ *] / d' -e 's / * \ (. * *) / \ 1 /' 'git push original $ branch
- (in ruby)
#! / Usr / bin / env ruby STDIN.read.split ("\ n"). Do each. Line | Oldrev, newrev, refname = line.split ('') if refname.match (/ ^ refs / heads \ / (. *) /) Branch = $ 1 `git push original # {branch}` and puts "# { Refname} was strange, not sure what to do. "And End
Comments
Post a Comment