git clone with HTTPS or SSH remote?

GitHub have changed their recommendation several times (example).

It appears that they currently recommend HTTPS because it is the easiest to set up on the widest range of networks and platforms, and by users who are new to all this.

There is no inherent flaw in SSH (if there was they would disable it) — in the links below, you will see that they still provide details about SSH connections too:

  1. HTTPS is less likely to be blocked by a firewall.

    https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls

    The https:// clone URLs are available on all repositories, regardless of visibility. https:// clone URLs work even if you are behind a firewall or proxy.

  2. An HTTPS connection allows credential.helper to cache your password.

    https://docs.github.com/en/get-started/quickstart/set-up-git#connecting-over-https-recommended

    If you clone with HTTPS, you can cache your GitHub credentials in Git using a credential helper. For more information, see “Cloning with HTTPS urls” and “Caching your GitHub credentials in Git.

Leave a Comment