Skip to content
Snippets Groups Projects
Commit d65baebd authored by Kaan Cimir's avatar Kaan Cimir
Browse files

create key based authentication card

parent 6e512c4b
No related branches found
No related tags found
No related merge requests found
external/contribute/ssh-key-generation/img/key-details.png

182 KiB

external/contribute/ssh-key-generation/img/new-key.png

88.8 KiB

external/contribute/ssh-key-generation/img/preferences.png

17.1 KiB

external/contribute/ssh-key-generation/img/ssh-menu.png

32.4 KiB

---
layout: page
permalink: /external/contribute/ssh-key-generation/
shortcut: contribute:ssh-key-generation
redirect_from:
- /cards/contribute:ssh-key-generation
- /external/cards/contribute:ssh-key-generation
- /contribute/ssh-key-generation
- /external/external/contribute/ssh-key-generation/
---
# Key-based Authentication
Key-based authentication allows GitLab users to identify their device once on their account and avoid having to log in via their credentials every time. GitLab uses SSH protocol to communicate with Git.
SSH uses a public and a private key. The public key must be registered to GitLab, make sure you **do not upload your private key**.
# Prerequisites
To use SSH one of the following must be installed:
- The OpenSSH client, which comes pre-installed on GNU/Linux, macOS, and Windows 10.
- SSH version 6.5 or later. Earlier versions used an MD5 signature, which is not secure.
To view the version of SSH installed on your system, run the following command on your terminal (on Linux or macOS) or Git Bash (on Windows)
```
ssh -V
```
# Key Generation
1. Run the terminal
2. Type the following command at the command prompt and run it after replacing your firstname and lastname:
```
ssh-keygen -t ed25519 -C firstname.lastname@uni.lu
```
3. Accept the suggested filename and directory
4. Press `Enter` to continue. Defining a password is not necessary
5. To copy the contents of your public key file, run the following command:
- For macOS:
```
tr -d '\n' < ~/.ssh/id_ed25519.pub | pbcopy
```
- For Windows:
```
cat ~/.ssh/id_ed25519.pub | clip
```
# Saving the SSH Key on GitLab
Once the content of the public key is copied, it must be saved to your GitLab account.
To save your key to your account:
1. Log in to your GitLab account
2. Navigate to the `Preferences` menu
![preferences](img/preferences.png)
3. User settings will be displayed on the left-hand side menu. Click on the "SSH Keys" option
![ssh-menu](img/ssh-menu.png)
4. On the `SSH Keys` page, click on `Add new key` button to add your public key
![new-key](img/new-key.png)
5. Paste your new key into the `Key` box, name the key and save it by clicking the `Add key` button
![key-details](img/key-details.png)
# Troubleshooting
Please refer to the [GitLab Docs](https://service.uni.lu/sp?id=sc_cat_item&table=sc_cat_item&sys_id=c1d98bacdb9cf810ca53454039961917) or [create a ticket](https://service.uni.lu/sp?id=sc_cat_item&table=sc_cat_item&sys_id=c1d98bacdb9cf810ca53454039961917) for further assistance regarding the key-based authentication.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment