Re: backup git repo on every commit
- From
Israel Garcia <igalvarez@gmail.com>
- Date
- Oct 12, 2009, 14:39 UTC
- Message-ID
- <194a2c240910120739j58cc1ec0o629b0df7d31e3fdd@mail.gmail.com>
- In-Reply-To
- <20091012143043.GJ9261@spearce.org>
On 10/12/09, Shawn O. Pearce <spearce@spearce.org> wrote:
Show 12 quoted lines
> Israel Garcia <igalvarez@gmail.com> wrote: >> That's OK, but I want to backup my git repo locally > > Just change the path of the backup remote (that final argument to > git remote add) to point to the local directory. > > Though I guess you would also need to run git init there, e.g.: > > git --git-dir=/backup/project.git init > git remote add --mirror backup /backup/project.git > > # and create the hook as below
Nice..:-)
> > Of course, backup to another folder on the same disk isn't a backup > at all, the disk can still fail and lose both repositories.
Yeap, but I use rsync to backup /backup folder on a remote server every night. /backup folder other apps backups.
thanks Shawn.
regards
Israel.
Show 20 quoted lines
> >> On 10/12/09, Shawn O. Pearce <spearce@spearce.org> wrote: >> > Israel Garcia <igalvarez@gmail.com> wrote: >> >> Which is the simplest way to backup a git repository after every >> >> commit? >> > >> > Add a commit hook to push to another location, e.g.: >> > >> > git remote add --mirror backup you@another.host:path/to/backup.git >> > >> > cat >.git/hooks/post-commit >> > #!/bin/sh >> > git push backup >> > ^D >> > >> > chmod a+x .git/hooks/post-commit > > -- > Shawn. >
-- Regards; Israel Garcia