Topics Map > Engineering Digital Service > Services > GitLab

GitLab Tutorials – Creating an SSH key and configuring it for use with GitLab

Below is a comprehensive guide on generating and configuring an ED25519 SSH key for use with GitLab on UMD's instance at code.umd.edu. Follow these steps to securely connect to GitLab.

Table of Contents

  1. Generate an ED25519 SSH Key
  2. Start the SSH Agent and Add Your Key
  3. Copy Your Public Key
  4. Add Your SSH Key to GitLab
  5. Verify Your SSH Connection
  6. Additional Tips

1. Generate an ED25519 SSH Key

Open your terminal and run the command below (replace your_email@umd.edu with your actual UMD email):

ssh-keygen -t ed25519 -C "your_email@umd.edu"

When prompted:

  • Enter a file in which to save the key: Press Enter to accept the default location (typically ~/.ssh/id_ed25519).
  • Enter passphrase: Provide a strong passphrase (recommended) or leave it empty if you prefer not to use one.

2. Start the SSH Agent and Add Your Key

Ensure the SSH agent is running and add your new key:

eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519

3. Copy Your Public Key

Your public key is stored in ~/.ssh/id_ed25519.pub. To copy it to your clipboard:

  • macOS:
    pbcopy < ~/.ssh/id_ed25519.pub
  • Linux (with xclip installed):
    xclip -selection clipboard < ~/.ssh/id_ed25519.pub
  • Manual Copy: Open the file using:
    cat ~/.ssh/id_ed25519.pub
    and copy the output.

4. Add Your SSH Key to GitLab

Now that you have copied your public key, follow these steps:

  1. Log in to GitLab: Visit code.umd.edu and log in using your UMD CAS credentials.
  2. Access SSH Keys Settings: Click your profile icon (top right) and select Settings. Then, choose SSH Keys from the sidebar.
  3. Paste Your Public Key: In the “Key” field, paste your public key. Optionally, add a title (e.g., "My Laptop ED25519 Key") and set an expiration date if desired.
  4. Add the Key: Click Add key to save your SSH key.

5. Verify Your SSH Connection

Test your setup by running the following command:

ssh -T git@code.umd.edu

You should see a welcome message indicating that GitLab has recognized your SSH key, for example:

Welcome to GitLab, @yourusername!


6. Additional Tips

  • Passphrase Security: Always choose a strong passphrase to protect your private key.
  • Backup: Keep a secure backup of your private key in case of data loss.
  • Troubleshooting: If you encounter issues, ensure the SSH agent is running and that your public key is correctly added to your GitLab account. Refer to the GitLab SSH documentation for further guidance.

Need Help?

If you encounter any problems during this process, please contact the Engineering Digital Service at eds@umd.edu for assistance.



Keywords:
GitLab, ED25519, SSH key, generate SSH key, SSH agent, public key, private key, secure authentication, UMD, code.umd.edu, terminal commands, SSH configuration, UMD CAS, Engineering Digital Service, eds@umd.edu 
Doc ID:
148751
Owned by:
Nicholas B. in Engineering IT
Created:
2025-03-04
Updated:
2025-03-04
Sites:
University of Maryland Engineering IT