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
- Generate an ED25519 SSH Key
- Start the SSH Agent and Add Your Key
- Copy Your Public Key
- Add Your SSH Key to GitLab
- Verify Your SSH Connection
- 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
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.puband copy the output.
4. Add Your SSH Key to GitLab
Now that you have copied your public key, follow these steps:
- Log in to GitLab: Visit code.umd.edu and log in using your UMD CAS credentials.
- Access SSH Keys Settings: Click your profile icon (top right) and select Settings. Then, choose SSH Keys from the sidebar.
- 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.
- 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.