This forces GitHub to always use SSH, even for HTTPS URL’s!

git config --global url."[email protected]:".insteadOf ""

This way, you can use https:// GitHub URL’s and they will still use your SSH key.

git clone
# rewrites to `[email protected]:rstacruz/vimfiles.git`

Always HTTPS

Alternatively, this forces GitHub to always use HTTPS. Great for OSX, where you can use git-credential-osxkeychain to store your GitHub token.

This will not rewrite [email protected]:user/repo.git URL’s, though, so I don’t really recommend it! Besides, SSH keys are often easier to manage than API tokens.

git config --global url."https://github".insteadOf git://github


Hat tip to these people!