Git: force to use SSH URL instead of HTTPS for


You can instruct git to use the SSH git clone url (git@...) instead of HTTPS one (https://) in every case.

Regardless of whether e.g. your CocoaPods spec includes the SSH or HTTPS git clone url git will always use the SSH one (git@) this way. This can be useful if you use private submodules or CocoaPods spec/repos or any other tool which uses git and you want to force them to use SSH git clone URLs instead of HTTPS ones, as explained at:

To reconfigure git to use SSH git clone URLs for github instead of HTTPS ones just run (e.g. using a Script step):

git config --global url."".insteadOf ""

This instructs git that in every case when the git clone URL starts with it should replace it with before contacting the server.

Note: this affects every git operation after running this git config, for repos! It will always convert the URL and will use the SSH url instead for repos.




My private repo is hosted on and I tried your suggestion but with and it didn’t work :confused:

Any suggestions @viktorbenei ?