Make new key
ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519_gitlab_ee -C "your_email@example.com"
add to gitlab
- Configure SSH to Use Your Specific Key
Because Git looks for default key names (like id_ed25519 or id_rsa), you must tell SSH when to use your new custom key. [1, 2]
Open or create your SSH configuration file:
bash
nano ~/.ssh/configUse code with caution.
Add the following block, replacing
://yourcompany.comwith your self-hosted GitLab EE domain (orgitlab.comif using their cloud enterprise edition):text
Host ://yourcompany.com HostName ://yourcompany.com User git IdentityFile ~/.ssh/id_ed25519_gitlab_eeUse code with caution.
Save and close the file (in Nano, press
Ctrl+O,Enter, thenCtrl+X).Add the Key to Your Local SSH Agent
To avoid entering your password every time, register the key with your system's ssh-agent: [1, 2]
bash
# Start the ssh-agent in the background
eval "$(ssh-agent -s)"
# Add your custom private key
ssh-add ~/.ssh/id_ed25519_gitlab_ee
Use code with caution.
- Add the Public Key to GitLab EE
Now, you need to copy the contents of the public key file (.pub) and add it to your profile. [1, 2]
Copy the public key to your clipboard:
Click your Avatar in the top-right corner and select Preferences or Edit Profile. [1, 2, 3]
Click Add new key, paste your public key text into the field, give it a recognizable title, and click Add key. [1, 2, 3]
Verify the Connection
Test your setup by running the following command in your terminal: [1]
bash
ssh -T git@spiffydesign.com
Use code with caution.
(Replace ://yourcompany.com with your actual instance domain).
If successful, you will see a message like:
Welcome to GitLab, @your_username! [1]