Rewrite any git:// urls to be https:// but, it won't touch sshurls ([email protected]:)
git config --global url."https://github".insteadOf git://githubUse ssh instead of https://
git config --global url."[email protected]:".insteadOf "https://github.com/"
@jasong-au Any time
gitis called, it'll check the~/.gitconfigfile for matches based oninsteadOf. This includes ifgo installis using git under the hood. Any timesshis called, it'll check~/.ssh/configfor matching host definitions. This includes ifgitis using ssh under the hood.So you can debug a
~/.ssh/configfile usingssh, such asssh githuborssh github.comand ensure it uses the hostname, username, and port defined in the config file.You can debug a
~/.gitconfigusinggit.Do something like this:
Just make sure that whatever you put in your
insteadOf =clause properly matches a URL for a git repo thatgo installis trying to access. And keep in mind that it's a find/replace matching from the start of the string, so you can swap any part of the start of the URL you want, including the entire URL. In my config I swaphttps://ourserver.organziation.example.commatching based oninsteadOf = https://github.com/organization/because we moved away from github and now have our own internal git server. By setting up the url mapping I didn't have to go through and update the URL for every repo already cloned on my workstation.