Pushing Git repos between random machines
Until today, I always used Github as a server, pushing my code changes there, then pulling from there to the deployment server (in a more or less automated fashion).
But today I ran into a locked down VM that blocked Github, so I had to find alternative ways to get my code there. The farmer method is to zip the code and scp it there, but I learned that you can just git pull code between random machine, with no special software needed.
The process is as follows:
On the remote VM:
> mkdir path/to/repo
> cd path/to/repo
> git init
> git checkout -b tmp
On the local machine:
> git remote add remote_name username@address:/path/to/repo
> git push remote_name master
On the remote VM:
> git checkout master
It's best if you have ssh authentication using public keys and don't forget to set up the SSH config correctly for Git.
It's nice when something in the software world just works!