Gitlab and SSH Keys
GitLab uses the SSH protocol to securely communicate with Git.
When you use SSH keys to authenticate to the GitLab remote server, you don't need to supply your username and password each time.
Add an SSH key to your account
To use Gitlab with SSH, you will need to register your SSH key to your Gitlab account by following the next steps:
Configuring Username and Email
- Open a terminal and run the below commands.
ssh config --global user.name <YOUR USERNAME> ssh config --global user.email <YOUR EMAILID>
Test the connection
Open a terminal and run this command.
ssh -T firstname.lastname@example.org
If this is the first time you connect, you should verify the authenticity of the GitLab host. If you see a message like:
The authenticity of host 'gitlab.orc.gmu.edu (188.8.131.52)' can't be established. ECDSA key fingerprint is SHA256:HbW3g8zUjNSksFbqTiUWPWg2Bq1x8xdGUrliXFzSnUw. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'gitlab.orc.gmu.edu' (ECDSA) to the list of known hosts.
yesand press enter.
ssh -T email@example.com again. You should receive a Welcome to GitLab, @username! message.