Which is the smarter git protocol, ssh or git(over ssh) or https protocol?
Update 2010-2014:
Both ssh and https are equivalent, since Git 1.6.6+ (2010) and the implementation of smart http protocol:
You now can use ssh or https for read/write access to your repos.
You can also detect if your remote server supports smart http.
Add the right environment variable if you have to use a proxy.
Q3 2015, as Yousha Aleayoub mentions in the comments:
GitHub "Which remote URL should I use?"
The
https://
clone URLs are available on all repositories, public and private.
They are smart, so they will provide you with either read-only or read/write access, depending on your permissions to the repository.
The git-http-backend
is the:
simple CGI program to serve the contents of a Git repository to Git clients accessing the repository over
http://
andhttps://
protocols.
The program supports clients fetching using both the smart HTTP protocol and the backwards-compatible dumb HTTP protocol, as well as clients pushing using the smart HTTP protocol.
Original answer (July 2010):
From the Pro Git Book:
Probably the most common transport protocol for Git is SSH.
This is because SSH access to servers is already set up in most places — and if it isn’t, it’s easy to do.SSH is also the only network-based protocol that you can easily read from and write to. The other two network protocols (HTTP and Git) are generally read-only, so even if you have them available for the unwashed masses, you still need SSH for your own write commands.
SSH is also an authenticated network protocol; and because it’s ubiquitous, it’s generally easy to set up and use.
So it is not "smarter" than Git protocol, just a complementary protocol for certain features not addressed by the Git protocol.
The downside of the Git protocol is the lack of authentication. It’s generally undesirable for the Git protocol to be the only access to your project.
Generally, you’ll pair it with SSH access for the few developers who have push (write) access and have everyone else usegit://
for read-only accessIt also requires firewall access to port 9418, which isn’t a standard port that corporate firewalls always allow. Behind big corporate firewalls, this obscure port is commonly blocked.
(that is why in my shop, I need to use ssh+git and not just git, even for read access: 9418 is blocked...)
Take a look at the second part of this page
The only "dumb" protocol is straight HTTP, which requires no special effort on the server. In both the git:// and ssh:// protocols, a git upload-pack
process (which is not a daemon) is forked on the server that communicates with the client who's running git fetch-pack
. In both ssh:// and git://, you get "smart" communication.
(I wanted to add a comment to @erjiang answer, but I'm not allowed because I don't have enough StackOverflow reputation.)
It seems that since Git 1.6.6, HTTP is not "dumb" anymore. From Git website's blog:
As of the release of version 1.6.6 at the end of last year (2009), however, Git can now use the HTTP protocol just about as efficiently as the git or ssh versions