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
On device without network
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.
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/projectX
and you've mounted the USB-stick as /media/user/USBDRIVE
user@devmachine:~/src/projectX$ git init --bare /media/user/USBDRIVE/projectX.git
user@devmachine:~/src/projectX$ git remote add usb /media/user/USBDRIVE/projectX.git
user@devmachine:~/src/projectX$ git push --mirror usb
for future updates, just run git push
again (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/USBDRIVE
again, run the following on your target. systems
pi@device:~$ git clone /media/user/USBDRIVE/projectX.git projectX
pi@device:~$ cd projectX
pi@device:~/projectX$ git checkout v1.0.0
for 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.
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.
user@devmachine:~/src/projectX$ git bundle create /path/to/projectX.bundle HEAD <tag_name>
or even better (exporting all known tags):
user@devmachine:~/src/projectX$ git bundle create /path/to/projectX.bundle HEAD $(git tag)
After that, you should be able to clone the bundle and checkout your tag:
pi@device:~$ git clone /media/user/USBDRIVE/projectX.bundle projectX
pi@device:~$ cd projectX
pi@device:~$ git checkout <tag_name>