DEV Community

Jonathan Carter
Jonathan Carter

Posted on

Do you clone Git repos via HTTPS or SSH?

Hey All! Random question: when you clone a Git repo, do you use HTTPS or SSH to do it? Furthermore, is your decision based on a specific reason (e.g. HTTPS is traditionally easier on Windows?, team policy?), or mostly just habit (e.g. you've already got an SSH key so why not re-use it! 🚀, that's what GitHub shows by default)? I've noticed a diverse set of opinions across folks I know, and I'm mostly just curious about others' usage in-the-wild.

Latest comments (45)

Collapse
 
sudiukil profile image
Quentin Sonrel

I've used HTTPS for years and switched quite recently to SSH because I got bored of typing a password. My laziness always win.

Collapse
 
brightmaraba profile image
Brian Koech

SSH. Intuitive and once set up, easy on the fly connection to all applications and devices I use.

Collapse
 
safijari profile image
Jariullah Safi

SSH as it's much easier when you use 2FA

Collapse
 
fancybanana profile image
FancyBanana • Edited

I have shared my config folder between all my machines so that I never have to login to do stuff. Ssh is magic with small upfront investment.

Collapse
 
dansayo profile image
Dan Sayo

SSH on Linux, Mac and Windows

Collapse
 
ferricoxide profile image
Thomas H Jones II

I've only ever willingly done via SSH. Mostly, when I'm doing HTTPS, it's because the repo-maintainer doesn't provide me the option for SSH.

Collapse
 
ahferroin7 profile image
Austin S. Hemmelgarn

I use Linux about 99% of the time when dealing with Git, so I've long since been in the habit of using SSH for almost all Git usage. The only times I use HTTPS are cases where I need read-only access to a repo that doesn't support SSH access.

Realistically though, I originally started using SSH for the following three reasons:

  • I use MFA on Github, and it's a bit of a pain to get that working correctly and securely on Linux without a desktop environment. SSH completely bypasses that issue.
  • Unlike HTTPS, SSH cloning uses Git's native protocol. This translates to somewhat more efficient cloning in many cases. This doesn't matter in many cases, but when you're dealing with repos with lots of history (for example, the Linux kernel sources) on a slow connection, it can make a significant difference.
  • I only use SSH between my own systems because it's exponentially easier to set up securely than mutually authenticated HTTPS.
Collapse
 
maxwellb profile image
Maxwell Bloch

HTTPS when I must (read-only or public GitHub) otherwise SSH (all pushes).
Cross platform, consistent, manageable, no plugins needed.
In Windows, GIT_SSH=C:\PuTTY\plink.exe and add my *.ppk key file (associated with Pagent) to the "Startup" folder in my user profile.

Collapse
 
dchapman1988 profile image
David Chapman

Oh God, ssh... Always ssh.

Collapse
 
beachbc profile image
Bradley Beach

SSH for osx and linux. Used to do https on Windows but now that SSH support is built in I use SSH there to.