| name | glab-ssh-key |
| description | Manage SSH keys on your GitLab account using the glab CLI. Use this skill whenever the user wants to add, list, view, or delete SSH keys on their GitLab account. Trigger on phrases like "add my SSH key to GitLab", "register SSH key", "list SSH keys", "remove an SSH key", or any GitLab SSH key management task. |
GitLab SSH Key Management
Use glab ssh-key to manage SSH public keys registered on your GitLab account. These keys enable git operations over SSH without a password.
Add an SSH Key
glab ssh-key add -t "<title>" ~/.ssh/id_ed25519.pub
glab ssh-key add -t "work-laptop-2025" ~/.ssh/id_ed25519.pub
glab ssh-key add -t "deploy-server" ~/.ssh/id_rsa.pub \
-u signing \
-e 2025-12-31
Key flags:
-t / --title display name for the key (required)
- The positional argument is the path to the public key file (
.pub)
-u / --usage-type purpose: auth | signing | auth_and_signing (default: auth_and_signing)
-e / --expires-at ISO 8601 expiry (e.g., 2025-12-31)
List SSH Keys
glab ssh-key list
Shows all SSH keys registered on your account with their IDs, titles, and fingerprints.
Get a Specific SSH Key
glab ssh-key get <id>
Delete an SSH Key
glab ssh-key delete <id>
Get the ID from glab ssh-key list.
Typical Workflow
ssh-keygen -t ed25519 -C "your@email.com"
glab ssh-key add -t "$(hostname)-$(date +%Y)" ~/.ssh/id_ed25519.pub
ssh -T git@gitlab.com
Behavior Guidelines
- Key file path: Always use the
.pub file (public key), never the private key. The private key stays on the user's machine.
- Key type: Recommend
ed25519 over rsa for new keys โ it's faster, more secure, and has a shorter public key.
- Title conventions: Suggest descriptive titles like
laptop-2025 or ci-server-prod so the user can identify keys later.
- Usage type: Use
auth_and_signing (default) unless the user specifically needs commit signing only (signing) or authentication only (auth).
- Expiry: Recommend setting expiry dates for keys used on shared systems or CI environments.