Today I Learned

A Hashrocket project

You Can Git Push to an SSH Alias

When we are using Git via ssh, we can take full advandage of our ssh conveniences.

So, lets say we have some ssh coniguration in our .ssh/config

Host til-production
  Hostname 11.22.333.44
  User ubuntu

Now we ssh into our server and create a bare repository.

ssh til-production
mkdir ~/til
cd ~/til
git init --bare

Then back on our local machine, instead of adding a remote with:

git remote add production ubuntu@11.22.333.44:til

we can simply:

git remote add production til-production:til

It’s a little bit less to think about.

h/t @vidalekechukwu