Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When would one use ssh or http to clone?

Tags:

git

When cloning a Git repository, one has a couple of options on the url to clone the repository from. For exapmle, https and ssh.

I understand one would use the ssh if the repo is hosted on a private server, but if the project is hosted on Github itself, is there a difference between cloning via http or via ssh?

like image 751
Jeeter Avatar asked Jun 10 '26 03:06

Jeeter


1 Answers

The difference is in the protocol used, as you probably guessed. Assuming you don't much care about the technical details between HTTPS and ssh, ssh has the advantage that you can use public key authentication, while you must use a username and password with HTTPS. They both get the repository onto your computer and allow you to interact with remotes in the same way. HTTPS also has the advantage that it tends to play nicer with firewalls than ssh does, though I've never run into a network that prevents me from using ssh.

As @Jeeter's answer explains, Github encourages you to use HTTPS, so go with that if you're in doubt, I guess.

like image 174
Grace Avatar answered Jun 13 '26 18:06

Grace



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!