I frequently use git ‘guerrilla-style’ by nesting a git repo inside a Subversion, Perforce or CVS sandbox. When I’m working this way, I like to create a ‘remote’ repo on a USB stick so that I have a backup, in case my hard drive dies:
$ git --bare init /f/projects/myproj.git
$ git remote add origin /f/projects/myproj.git
$ git push -u origin master
Then I just need to remember to type git push every now and then to back up my work. If my repo gets hosed, I can get it back with:
$ git clone /f/projects/myproj.git
Lately I’ve been maintaining a stack of patches against an upstream Perforce repo using StGit. My simple backup strategy no longer works in this case. Neither git clone or stg clone seem to work: if I type stg series after cloning, it tells me stg series: master: branch not initialized.
Poking around some, I’ve seen that stgit creates a master.git branch and several other temporary(??) branches to store metadata. It seems like it should be possible to set things up so that all these branches get pushed to the backup repo, but I’m not sure how to go about it.
Update [12/15/2011]: Looking at the stgit-managed repo I want to back up in qgit, I see that it looks like this:

I tried Jefromi’s suggestion of using push --all:
$ git --bare init luasand_stg_bak
Initialized empty Git repository in c:/d/projects/luasand_stg_bak/
$ cd luasand_stg
$ git remote add backup ../luasand_stg_bak
$ git push -u --all backup
Counting objects: 369, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (364/364), done.
Writing objects: 100% (369/369), 467.79 KiB, done.
Total 369 (delta 73), reused 0 (delta 0)
To ../luasand_stg_bak
* [new branch] master -> master
* [new branch] master.stgit -> master.stgit
Branch master set up to track remote branch master from backup.
Branch master.stgit set up to track remote branch master.stgit from backup.
This pushes the master.stgit branch, but doesn’t push some some other required metadata:

From the above screen shot, you can see there’s a top-level patches folder and a refs/patches folder that are present in the original repo, but not in the backup. This all leads me to believe I’m barking up the wrong tree. Is there no way to back up the StGit metadata using standard git commands? If not, what’s the best way to back up my work-in-progress on a complex patch series in case of a borked rebase or hard drive failure?
It seems that trying to back up an StGit work area by cloning is counterproductive. I’ve settled on a simpler method that relies on
stg exportandstg import. It works like this:So, rather than attempt to back up the whole repo, I’m just backing up each individual patch to
/f/projects/luasand_stg_patcheson my USB stick. This means I have to ensure that the source repo,luasandis backed up somewhere, too, so I can recreate the state of my work area by (re-)cloning it withstg cloneand re-importing my patches.I don’t love this workflow, but at least I can understand it. I’ll wait awhile before accepting this answer to see if anyone can offer a simpler solution…