Navigate to your .ssh folder and generate a ssh key. Put a name on it and a password.
ssh-keygen -t rsa
This command will generate 2 files (private and public keys):
key_name
key_name.pub
Navigate to Gitlab (or Bitbucket) settings and find the tab for importing your ssh key.
Important: when uploading/pasting your SSH key, you are importing just the public (.pub) key! Also, every project has to have the SSH url set in the git config file in order for this to work!
To test is the key is imported correctly, navigate in the terminal to your project and try to
git pull
After that, check in the Gitlab/Bitbucket SSH settings if the "last used" is changed to "1 minute ago" or so.
Important notice for Bitbucket: in order to make Bitbucket work, use the command to gather the public ssh key and link it with Bitbucket:
ssh-keyscan -t rsa bitbucket.org
Don't forget to change the path to the new ssh file in .ssh/config.