Last Updated: September 14, 2017
·
172
· caseywebb

Shorter SSH Git Remotes using Aliased Hosts

Typically, when cloning or setting the url for a GitHub repo accessed via SSH, you have something like...

$ git clone git@github.com:caseyWebb/my-cool-repo

...but, if you alias the GitHub host in ~/.ssh/config as such...

Host gh
  HostName github.com
  User git

...your remotes can be much shorter...

$ git clone gh:caseyWebb/my-cool-repo