
- Git - Home
- Git - Version Control
- Git - Basic Concepts
- Git - Command Line
- Git - Installation
- Git - First Time Setup
- Git - Basic Commands
- Git - Getting Help
- Git - Tools
- Git - Cheat Sheet
- Git - Terminology
- Git - Life Cycle
- Git - Get a Repository
- Git - Adding New Files
- Git - Recording Changes
- Git - Viewing Commit History
- Git Branching
- Git - Branches in a Nutshell
- Git - Creating a New Branch
- Git - Switching Branches
- Git - Branching and Merging
- Git - Merge Conflicts
- Git - Managing Branches
- Git - Branching Workflows
- Git - Remote Branches
- Git - Tracking Branches
- Git - Rebasing
- Git - Rebase vs. Merge
- Git - Squash Commits
- Git Operations
- Git - Clone Operation
- Git - Tagging Operation
- Git - Aliases Operation
- Git - Commit Operation
- Git - Stash Operation
- Git - Move Operation
- Git - Rename Operation
- Git - Push Operation
- Git - Pull Operation
- Git - Fork Operation
- Git - Patch Operation
- Git - Diff Operation
- Git - Status Operation
- Git - Log Operation
- Git - Head Operation
- Git - Origin Master
- Git Undoing
- Git - Undoing Changes
- Git - Checkout
- Git - Revert
- Git - Reset
- Git - Restore Operation
- Git - Rm
- Git - Switch Operation
- Git - Cherry-pick
- Git - Amend
- Git on the Server
- Git - Local Protocol
- Git - Smart HTTP Protocol
- Git - Dumb HTTP Protocol
- Git - The SSH Protocol
- Git - The Git Protocol
- Git - Getting Git on a Server
- Git - Setting up the Server
- Git - Daemon
- Git - GitWeb
- Git - GitLab
- Git - Third Party Hosted Options
- Distributed Git
- Git - Distributed Workflows
- Git - Contributing to a Project
- Git - Maintaining a Project
- Customizing Git
- Git - Configuration
- Git - Hooks
- Git - Attributes
- Git - Init
- Git - Commit
Git - SSH Protocol
The SSH (Secure Shell) protocol is a widely used transport protocol that is simple to set up and widely available for self-hosted Git repositories. The operations such as cloning, pushing, and fetching are all supported. Here Git uses SSH for authentication of the users and encryption of data transferred over network.
It is frequently selected because SSH access to servers is either pre-established or simple to set up.
Git operations are made easier to use and more reliable by SSH's provision of authorized network connection.
Key Features
Some of the key features of SSH are:
1. Authentication Secured − Public key cryptography is used by SSH for authentication. A pair of SSH keys is generated by the user:
Public Key − Key that is shared with the Git server, such as GitHub, GitLab.
Private Key − Key that remains on the user's machine and does not require a password to access.
2. Data Encryption − Confidentiality and protection maintained by encryption of all the data that gets transferred from client to server and vice-versa.
3. Easy Access − Automatic authentication takes place, once the SSH key is configured. Hence there is no need to enter password every time you connect to the remote repository.
How It Works?
Following are the steps that describes how SSH protocol works:
Generating SSH Keys − Generate the SSH key pair on your local machine, using ssh-keygen.
Adding Public Key to Server − The public key generated in the previous step is added to the remote Git server, ie., to your GitHub or GitLab account under the SSH keys.
Using SSH URLs − Use the SSH URL to access the repository, instead of using HTTP(S) URL.
SSH-Agent − In order to cache your SSH key, to avoid adding the key's paraphrase repeatedly, you can use the ssh-agent on your local machine.
To clone a Git repository over SSH, use either:
git clone ssh://[user@]server/project.git
or
git clone [user@]server:project.git
If no username is specified in the URL, Git assumes the current logged-in user for authentication.
Advantages
Following are few of the advantages of using SSH for Git repositories:
Highly Secured − SSH improves overall security by ensuring secure access through verified and encrypted data transfers.
Fater Performance −SSH is effective in improving data transfer size and performance, compared to HTTPS and Local protocols.
Trusted Connectivity − The connection and communication with server is trusted and secured, after the initial connection, where the server's SSH fingerprint is verified.
Passwordless Access − After the initial setup, there is no need to enter the password to interact with the remote repository.
Disadvantages
Following are some of the disadvantages of using SSH for Git repositories:
Complex Setup − Setting up SSH keys can be complex and time-consuming, especially for beginners.
Lack of Support − The lack of support for anonymous access in SSH for Git repositories is a disadvantage.
Limitation with Open-Source − Clones and repository access require SSH access, which can be limiting for open-source projects that frequently permit anonymous cloning.
Performance Overhead − SSH is generally fast, but the encryption and decryption process introduces latency during data transmission.
Difficult in Collaborative Environment − It is less ideal for environments where multiple users need to access a shared account, will require individual SSH key added to the account.
In spite of these limitations, SSH remains the most trusted and widely used secured communication protocol.