In my air-gapped Lab I have been making some changes to my configuration management configuration that I now need to extract and push back upstream. Since my air-gapping is a defensive measure against accidentally interfering with my live network, rather than any concern about data security/privacy this is just a case of using a USB drive to export and then push the commits.

First I created a fresh clone of the Git repository with the commits I wanted to extract:

cd /tmp
git clone /srv/salt

I then compressed the clone:

tar zcf salt.tar.gz salt

On the desktop box, I scp’d the file over to a removable drive (the reason for doing it this way is my desktop box does not have Git installed on it):

scp my_user@starfleet-command:/tmp/salt.tar.gz /media/user/USB_DRIVE/

Then I ejected the drive, mounted it on an internet connected box, added the remote and did a standard git push:

# after mounting the drive
tar -C /tmp -zxf salt.tar.gz
cd /tmp/salt
git remote set-url origin
git push