What is SSH Protocol
Git is a distributed version control system, which means you can work locally but you can also share or “push” your changes to other servers. Before you can push your changes to a GitLab server you need a secure communication channel for sharing information.
The SSH protocol provides this security and allows you to authenticate to the GitLab remote server without supplying your username or password each time.
For a more detailed explanation of how the SSH protocol works, read this nice tutorial by DigitalOcean
Note : Those text collect from Gitlab Website Document. Here is the link.
Types of SSH keys and which to choose
GitLab and also github supports RSA, DSA, ECDSA, and ED25519 keys. Their difference lies on the signing algorithm, and some of them have advantages over the others. For more information, you can read this nice article on ArchWiki. We’ll focus RSA here.
RSA keys are the most common ones and therefore the most compatible with servers that may have an old OpenSSH version. Use them if the GitLab server doesn’t work with ED25519 keys.
RSA SSH Key
The minimum key size is 1024 bits, defaulting to 2048. If you wish to generate a stronger RSA key pair, specify the -b flag with a higher bit value than the default.
The old, default password encoding for SSH private keys keys is insecure; it’s only a single round of an MD5 hash. Since OpenSSH version 6.5, you should use the -o option to ssh-keygen to encode your private key in a new, more secure format.
Check if Already RSA found or not
Open your command line prompt or git bash and write following line
ssh-keygen -o -f ~/.ssh/id_rsa
If it’s how already found then you can found it on your user directory, for my case screenshot attached.
If not found then it will prompt for Passphrase. Git a suitable password and again same password you will found the a key is generated. Just Copy the code in gitlab or github account, go the world of smart coding.
Now usually in you user directory you will found id_rsa.pub file, then upload the key to server, you will get git access.