Skip to content

Instantly share code, notes, and snippets.

@bernd
Forked from cararemixed/.gitconfig
Created August 27, 2014 09:49
Show Gist options
  • Save bernd/9f1f78384b35de3a1656 to your computer and use it in GitHub Desktop.
Save bernd/9f1f78384b35de3a1656 to your computer and use it in GitHub Desktop.
[url "https://github.com/"]
insteadOf = git://github.com/
insteadOf = git@github.com:
insteadOf = gh:
insteadOf = github:
[url "https://github.com/standard-analytics/"]
insteadOf = sa:
[url "https://git.apache.org/repos/asf/"]
insteadOf = apache:
[url "https://github.com/strmpnk/"]
insteadOf = my:

These shortcuts do two things. First, it translates all github ssh & git protocol based URLs with HTTPS. This is a big win when behind strict firewalls and just as efficient since GitHub runs a smart HTTP server which intelligently packs content just like the git protocol does. It also lets you use your HTTP credentials rather than dealing with SSH keys (don't forget git config --global credential.helper osxkeychain or similar depending on your platform).

The second part is more about sugar. It gives nice short names for remotes. You can do something like git clone apache:couchdb and you magically end up with the right stuff... no more memorization of that ugly ASF URL. An thing to note is that your repo's git configuration will reference the short-hand URL so if you remove the shorthand configuration it will stop working. Commands like git remote -v will still show the expanded version, but don't be fooled. You can always check your configuration file with a quick cat .git/config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment