How can I push to a git bundle

Viewed 5819

I'm just starting to use git for version control. I'd like to keep a backup copy of my repository on a local fileserver. After reading about the right way to backup a git repository, I decided to store the repository as a git bundle on the fileserver.

I can bundle my repository and copy the resulting bundle to the fileserver. Check. I also tried cloning and pulling from it. Everything working well. However, I'd like to push my local changes from time to time as well. When I execute something like

git push bundlefile.git

I get the error:

error: failed to push some refs to 'bundlefile.git'

You can clone or pull from a bundle, but is it not possible to push to it? I don't really want to create a bundle of my whole repository every time I want to back up.

Is this user error or are bundles not intended to be pushed to?

3 Answers

If you have write access to the remote fileserver, surely:

myrepo$ git init --bare //server/my/backup/folder/myrepo.git
myrepo$ git remote add backup  //server/my/backup/folder/myrepo.git
myrepo$ git push backup --mirror

I haven't tried this exactly, but in MSys I have done it with paths like /j/myFolder/myrport.git and

myrepo$ git push --set-upstream backup master

Then a restore is just a clone of that,

dev$ git clone //server/my/backupo/folder/myrepo.git
Cloning into myrepo...
dev$ cd myrepo

and you're back to pushing happily again.

Related