Skip to content

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:

  1. Verify if you have an existing key in your system. If not, generate one.

  2. Add the SSH key to your Gitlab account.

Configuring Username and Email

  1. Open a terminal and run the below commands.
    git config --global user.name <YOUR USERNAME>
    git config --global user.email <YOUR EMAILID>
    

Test the connection

  1. Open a terminal and run this command.

    ssh -T git@gitlab.orc.gmu.edu
    
  2. 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 (129.174.21.40)' 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.
    

    Type yes and press enter.

  3. Run the ssh -T git@gitlab.orc.gmu.edu command again. You should receive a Welcome to GitLab, @username! message.