What's the purpose of SSH?

When you create a new project in GitLab, it shows a message:

You won’t be able to pull or push project code via SSH until you add an SSH key to your profile.

There are a few pages on GitLab that explains how you can generate SSH Key but none of them ever say why you should use it in the first place.

  1. Why shouldn’t I prefer HTTPS over SSH?
  2. What are the differences between the two?

This question further illustrates the lack of good documentation, I am yet to get an answer to any of my GitLab’s related questions on GitLab itself. GitLab hasn’t addressed this question but GitHub has. They recommend HTTPS.

I would appreciate if someone could explain why SSH is preferred on GitLab and why not to use HTTPS.

Chinmay, you can push and pull from git via two methods, either point it to an HTTP address and use your username and password of that .git repo, or you can push and pull via SSH which would be your IP:/project_location.git
It is just what method of authentication you want to use. HTTPS should be fine too but you don’t use a key and you constantly need to use your User name and password. If you set up public private key pair on your host machine the authentication should be pretty transparent

Have you had any luck?

–Dean

Yeah now I know that, I came to know the difference between the two from some other site and use SSH since then.

SSH keys are way more secure than usernames and passwords.