How to use Git in a sneakernet environment?

My project has a number of test PCs which are 100% off-net. We use a USB drive to transfer files too and from these PCs. Some development happens during the tests on those PCs. We transfer zips of the updated files, with the ‘version info’ coded in the name of the zip file.

My question is how best to use Git for managing the sneakernet transfer of files (or repos, or what?) between the project’s office PCs and the test PCs. It’s not the normal ‘use case’ that is often presented for laptop users being ‘off-net’ and developing in some corner cafe, and later getting back on net.

  • Git clone stuck — Blocked ports?
  • git and local modifications
  • Branch name within git post hook
  • Does .gitignore work on commit, push, or upon reaching the server?
  • How can I see a file as it was at a particular git commit?
  • Magento's SUPEE-6788 patch not working with Git/Github
  • Has anyone got experience in such scenarios?

    Also see the git bundle create –all answer to transfer a complete repo

  • When is it safe to rewrite git history when local branches are present?
  • git aliases causing “Permission denied” error
  • Error getting local git to new github repository
  • Wrong PHP version returned in Openshift
  • How to separate content from structure in a git repository?
  • Get a local copy of a GitHub repo, track changes and push updates back to the remote
  • 4 Solutions collect form web for “How to use Git in a sneakernet environment?”

    Using Git with unconnected computers is easy with git bundle.

    See its man page.

    You can also keep a clone of the repository on a USB drive. ‘push’ from the off-net PC to the USB drive, then ‘push’ from the uSB drive to the central repository.

    It might be better to have the USB drive repository with its own working directory (also on the USB drive). Then ‘pull’ to the usb drive from the off-net PC, and ‘push’ from the USB drive to the central repository. When that push happens, you can do merging, if necessary, on the USB drive.

    Readers who get here are probably also interested in using-git-on-usb-stick-for-travelling-code which has a great set of similarities. It probably won’t work for my environment where there are two of use doing the sneakernet use/edit movements (i.e two separate USB drives), but it is a possibility.

    It all depends on how much you trust the transfer drive, and if the tools can work when you haven’t got it plugged in….

    I found this tutorial even more helpful than the man page because it gives an example of how Git checks that the incoming bundle and the target repository share a common ancestor commit:

    Git Baby is a git and github fan, let's start git clone.