How can I push to a git bundle
You cannot push directly to a bundle file. A bundle file is a compressed representation of a repository, and to modify it would involve unbundling, pushing, and bundling again.
One way to do this is as you said, create a new bundle every time you want to make a backup.
Another way is to create a bare repository on the file server, and push to that. A bare repository is a repository without a working directory, which is essentially the contents of the .git
directory from a normal clone. You can create a bare repository with git init --bare
.
If you have write access to the remote fileserver, surely:
myrepo$ git init --bare //server/my/backup/folder/myrepo.gitmyrepo$ git remote add backup //server/my/backup/folder/myrepo.gitmyrepo$ 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.gitCloning into myrepo...dev$ cd myrepo
and you're back to pushing happily again.