Question in the title, but let me detail more. Excluding the ID/Password method on git CLI, we generate a SSH key and add the public key to the remote server. Why don't we have SSH-less public-key cryptography methods? We are not even connecting to remote a machine's terminal, we don't even need to connect a remote machine's terminal (do we?), so why is it named as SSH key? Is it just about naming convention, or something else? What is the history behind that?
1 Answer
As one StackOverflow answer says (mentioned in a comment), early in Git's history the ssh protocol had the benefits of supporting both read and write access to the backend repo, as well as cryptographically strong authentication and encryption.
Another benefit of ssh is it allows managing/replacing the keys independently of your deploy software. I.e., your deploy scripts don't have to know how to read the auth token from somewhere and and deliver it to the server.
There certainly are other protocols with comparable functionality, but these are among the reasons that git+ssh became so widely used over the past 10+ years.
man git-shell
to clear up some confusion.ssh
is both the name of a transport protocol (RFC 4253) and of the secure remote shell which runs on top of that transport. In this case, you are usingssh
transport (RFC 4253) andssh
authentication (RFC 4252) to establish a secure authenticated network connection to yourgit
server, even though you are not running a login shell (roughly RFC 4254) on the remote machine. Of course, you have other transport options as well (https) where you would not use ssh keys.