RSA still works, but there are safer and more modern options you should consider for SSH keys, especially for GitLab.
This is the preferred option unless you must support very old systems.
ssh-keygen -t ed25519 -f ~/.ssh/second-account -C "user-2@example.com"
Why Ed25519?
This should be your default choice in 2025.
If you must use RSA (e.g. legacy systems, older hardware security modules):
ssh-keygen -t rsa -b 4096 -f ~/.ssh/second-account -C "user-2@example.com"
Notes:
If you have a YubiKey or similar device:
ssh-keygen -t ed25519-sk -f ~/.ssh/second-account -C "user-2@example.com"
or
ssh-keygen -t ecdsa-sk -f ~/.ssh/second-account -C "user-2@example.com"
Benefits:
Requires:
| Algorithm | Why |
|---|---|
dsa |
Broken / deprecated |
ecdsa |
OK but trickier and less robust than Ed25519 |
rsa -b 2048 |
Increasingly discouraged |
Since you’re a DevOps engineer and already managing multiple accounts, pair this with an SSH config:
Host gitlab-second
HostName gitlab.com
User git
IdentityFile ~/.ssh/second-account
IdentitiesOnly yes
Then use:
git clone git@gitlab-second:group/repo.git
ed25519ed25519-skrsa -b 4096