Git Tutorial
Git and GitHub
Git Contribute
Git Advanced
Git Undo
Git Security SSH
Git Security
HTTPS is also fine to work with, but if you are working with an unsecured network then the preference must be given to SSH.
What is SSH
SSH is a secure shell network protocol that is used for network management, remote file transfer, and remote system access.
SSH with the help of SSH keys establishes an authenticated and encrypted secure network protocol. It enables secure remote communication on unsecured open networks.
SSH keys initiate a secure “handshake”. While generating a set of keys, you will generate “public” and “private” keys.
The “public” key is the one that is shared with the remote party.
The “private” key is the one that is kept only by the user.
SSH keys are generated by using a security algorithm.
Generating an SSH Key Pair
In the command line for Linux, Apple, and in the Git Bash for Windows, SSH keys can be generated.
Begin by creating a new key, using your email as a label:
Example:
[user@localhost] $ ssh-keygen -t rsa -b 4096 -C “test@webhostguru.com”
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/user/.ssh/id_rsa):
Created directory ‘/Users/user/.ssh’.
Enter passphrase (empty for no passphrase):
Enter the same passphrase again:
Your identification has been saved in /Users/user/.ssh/id_rsaYour public key has been
saved in /Users/user/.ssh/id_rsa.pubThe key fingerprint is:
SHA256:*******************************************test@webhostguru.com
The key’s randomart image is:
+—[RSA 4096]—-+
| |
| |
| |
| |
| |
| |
| |
| |
| |
+—-[SHA256]—–+
You will be asked with the following through this creation:
Enter file in which to save the key (/c/Users/user/.ssh/id_rsa):
Select a file location, or press “Enter” to use the default file location.
Enter passphrase (empty for no passphrase):
Enter the same passphrase again:
This helps in creating an additional layer of security. It will prevent anyone, who gains access to the computer to use that key without the passphrase.
Now, this SSH key pair is added to the SSH-Agent (using the file location from above):
Example:
[user@localhost] $ ssh-add /Users/user/.ssh/id_rsa
Enter passphrase for /Users/user/.ssh/id_rsa:
Identity added: /Users/user/.ssh/id_rsa (test@webhostguru.com)
You will be asked to supply the passphrase , in case you have added one..