So this is my first real challenge using GIT. I have a personal repository set to master that I am ready to tag and release. The devices that will house my code will NOT have any internet accessibility and so I need to be able to upgrade the repository via a USB drive. I've been reading up on bundle files but am having difficulties user them for my intended purpose. Here are my steps so far.
On my personal device with internet
- git checkout <tag_name>
- git bundle create <bundle_name> <tag_name>
- copy bundle to a flash drive and plug it into device without network
On device without network
- copy bundle from flash drive to a local directory
- git clone <bundle_name> <code_dir>
Once I have cloned the bundle I get a warning stating, 'warning: remote HEAD refers to nonexistent ref, unable to checkout', and the only items in the directory is a .git file. I am sure I am not the first to run into this issue but have not been able to find a solution that works. Any and all thoughts will be greatly appreciated
I want to be able to maintain and update an offline git repository via bundle files.
method 1 (without bundles)
probably the simplest way is to ditch bundles altogether, and instead put a bare repository on the USB stick (at least, this is what i would do).
on your development machine (that has the code) - assuming that your project clone lives
~/src/projectXand you've mounted the USB-stick as/media/user/USBDRIVEfor future updates, just run
git pushagain (assuming the USB-partition is available under the same path)once you've synched all changes to the USB drive, unmount it and plug it into your target system. assuming the USB partitions ends up as
/media/user/USBDRIVEagain, run the following on your target. systemsfor future updates, just run
git fetch; git checkout v1.2.3(assuming again that the paths don't change)this method has the advantage, that it is very easy to push code from the device back to your devmachine.
method 2 (bundles)
if, for whatever reason, you cannot use the above method (e.g because the filesystem on the USB-drive is too limited), you can of course use bundles.
the trick is, that you have to provide more than just a single commit when creating a bundle.
or even better (exporting all known tags):
After that, you should be able to clone the bundle and checkout your tag:
See also https://git-scm.com/book/en/v2/Git-Tools-Bundling