GitLab Create SSH Key

To Create an SSH key navigate to: User Settings >> SSH Keys

Generate a Key

I am doing this on a Mac, open a terminal and enter:
ssh-keygen -t ed25519 -C "your_email@example.com"

Next it will ask for a location and file name, I have named this /.ssh/id_ed25519_GitLab and it is saved in the default location /Users/USERNAME/.ssh/id_ed25519_GitLab

Once created, cat the file to view the public key. Do not share the private key with anyone. Paste the public key into the box shown in the GUI.
cat /Users/stefankelly/.ssh/id_ed25519_GitLab.pub

Clone Repo Error – GitLab SSH Key Not Used

At this stage you should be able to clone a repo from the GitLab account. Hopwever, I am not able to because it is using the wrong SSH key. I have multiple SSH keys setup.

To fix this, I will add the private key to the ~/.ssh/config file. If this is not created, just create it touch ~/.ssh/config.
IdentityFile ~/.ssh/id_ed25519_GitLab

Testing

Re run the clone command, and I have added a file, commited and pushed this back to the repo.

Leave a Comment

Your email address will not be published. Required fields are marked *