Skip to content

SSH Keys

Guide for generating and managing SSH keys for access to GitLab and company servers.

Generating a Key

bash
ssh-keygen -t ed25519 -C "yourname@etnetera.cz"

When prompted for a path, press Enter (default ~/.ssh/id_ed25519). Set a strong passphrase.

TIP

We recommend the ed25519 type — it is more secure and shorter than RSA. If a server requires RSA: ssh-keygen -t rsa -b 4096 -C "yourname@etnetera.cz"

Adding the Key to ssh-agent

macOS

bash
eval "$(ssh-agent -s)"
ssh-add --apple-use-keychain ~/.ssh/id_ed25519

Add to ~/.ssh/config:

Host *
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_ed25519

Linux

bash
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519

Adding the Key to GitLab

  1. Copy the public key:
bash
cat ~/.ssh/id_ed25519.pub | pbcopy    # macOS
cat ~/.ssh/id_ed25519.pub | xclip     # Linux
  1. Go to gitlab.etnetera.czUser SettingsSSH Keys
  2. Paste the key, give it a name (e.g. MacBook-2024) and save

Verification

bash
ssh -T git@gitlab.etnetera.cz

Multiple Keys (optional)

If you use multiple accounts or keys, configure ~/.ssh/config:

# Company GitLab
Host gitlab.etnetera.cz
  HostName gitlab.etnetera.cz
  User git
  IdentityFile ~/.ssh/id_ed25519_etnetera

# Personal GitHub
Host github.com
  HostName github.com
  User git
  IdentityFile ~/.ssh/id_ed25519_personal

Security

  • Never share your private key (id_ed25519 without .pub)
  • Always use a passphrase
  • If a device is lost or compromised, immediately remove the key from GitLab and notify the IT team

Etnetera a.s. — IT Team