### ✅ Step 2: Generate a New SSH Key
GitLab recommends using **Ed25519** (more secure and faster than RSA).
```bash
ssh-keygen -t ed25519 -C "
[email protected]"
```
* When prompted:
* Enter a **file name** to save the key (e.g., `~/.ssh/id_gitlab_ed25519`) or just press Enter to use the default.
* Choose a **passphrase** for extra security (recommended).
---
### ✅ Step 3: Add Your SSH Key to the SSH Agent
Start the agent and add your key:
```bash
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_gitlab_ed25519
```
---
### ✅ Step 4: Copy the Public Key
```bash
cat ~/.ssh/id_gitlab_ed25519.pub
```
Copy the entire output.
---
### ✅ Step 5: Add the SSH Key to GitLab
1. Log into [GitLab](https://gitlab.com/).
2. Go to **User Settings** → **SSH Keys**.
3. Paste your public key.
4. Give it a title (e.g., "Laptop Key - May 2025").
5. Click **Add key**.
---
### ✅ Step 6: Test the Connection
```bash
ssh -T
[email protected]
```
You should see a message like:
```
Welcome to GitLab, @yourusername!
```
---