Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I push to a git bundle

Tags:

git

push

bundle

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?

like image 306
farnsy Avatar asked Aug 09 '12 02:08

farnsy


People also ask

How do I push to a git repository?

At the top of your repository on GitHub.com's Quick Setup page, click to copy the remote repository URL. In the Command prompt, add the URL for the remote repository where your local repository will be pushed. Push the changes in your local repository to GitHub.com.

What can you do with git bundle?

Bundles are used for the "offline" transfer of Git objects without an active "server" sitting on the other side of the network connection. They can be used to create both incremental and full backups of a repository, and to relay the state of the references in one repository to another.

Does git bundle include all branches?

Essentially, a bundle is an archive file that a user can use with the git clone command to create a local repository. The bundle contains your source code, as well as the change history for the commits and branches that you reference during the bundle creation step.

How do I unpack a bundle file?

To extract the contents of a bundle file In the InfoBundler window, view the bundle file from which you want to extract the files. From the file menu, choose Extract.


1 Answers

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.

like image 170
Greg Hewgill Avatar answered Nov 16 '22 02:11

Greg Hewgill