Git can use four distinct protocols to transfer data:

  • Local
  • HTTP
  • Secure Shell (SSH)
  • Git

Local protocol

The local protocol, in which is the remote repository is on your current host machine. This is often used if everyone on your team has access to a shared file system or everyone logs into the same computer. (the latter would’t be ideal as your code repo reside on the same computer making a catastrophic loss much more likely)

You can clone, push to, and pull from a local file-based repository like this:

git clone /srv/git/project.git

The HTTP protocol

In version 1.6.6, smart HTTP was introduced that operates very similar to the SSH or Git protocol but runs over standard HTTPS ports and can use username/password authentication rather than having to set up SSH keys. You clone remote repository via:

git clone https://example.com/gitproject.git

The SSH protocol

A common transfer protocol for Git when self-hosting is over Secure Shell (SSH), SSH is also an authenticated network protocol. If you are using SSH, you must have SSH access to your machine because SSH uses a pair of keys to initiate a secure handshake between remote parties. You may find connection help from your organisation. To clone a Git repository over the SSH, you can specify an ssh:// URL like this:

git clone ssh://[user@]server/project.git

The Git protocol

Git protocol comes packaged with Git, it is similar to SSH but with absolute no authentication or cryptography. It is often the fastest network transfer protocol but might lead to an arbitrary code execution vulnerability.


Back to parent page: Getting a Git repository

DevOpsGitGit_Transfer_Protocol

Reference: