Sometimes you have tools that reference a github url with https and you want them to use ssh instead so your ssh key works.
In my case it is Cocoapods trying to clone a spec repo. Since I just enabled two-factor auth on my account it now stopped working:
Matts-iMac:Nutrition matt$ pod install Cloning spec repo `enquos` from `https://github.com/enquos/mib.ios.pod.podspec` Username for 'https://github.com': hammertoe Password for 'https://email@example.com': [!] Unable to add a source with url `https://github.com/enquos/mib.ios.pod.podspec` named `enquos`. You can try adding it manually in `~/.cocoapods/repos` or via `pod repo add`.
By putting the following in your
~/.gitconfig file you can force git to use SSH whenever it is asked to use a HTTPS url:
[url "firstname.lastname@example.org:"] insteadOf = https://github.com/ [url "email@example.com:"] pushInsteadOf = "git://github.com/" [url "firstname.lastname@example.org:"] pushInsteadOf = "https://github.com/"