Skip to main content
skill CX Codex

glab-ssh-key — Claude Code skill for GitLab SSH keys

The glab-ssh-key Claude Code skill manages SSH keys on a GitLab account. It runs for SSH setup and requests to add, inspect, or remove keys.

MIT 115 installs ★ 51 updated 2026-10-20

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add vince-winkintel/gitlab-cli-skills --skill glab-ssh-key -a claude-code
Open on GitHub

What glab-ssh-key does

The skill helps add SSH keys to a GitLab account, retrieve one key, list keys, and delete a key. It uses glab ssh-key add, get, list, and delete; lists and individual keys can be returned as JSON.

The glab CLI and an authenticated GitLab account are required. Add a public key such as ~/.ssh/id_ed25519.pub; uploading a private key exposes credentials. The --replace option deletes a key with a matching fingerprint before adding the new one. If the add operation fails, the old key has already been removed.

What it helps with

  • add a public SSH key to a GitLab account
  • list the account's SSH keys
  • retrieve a key by ID
  • delete a key by ID
  • return keys as JSON

Example prompts for the agent

  • Add the public key from ~/.ssh/id_ed25519.pub to my GitLab account with the title “Laptop”.
  • Show my GitLab SSH keys as JSON.
  • Get the GitLab key with ID 123.

How to install glab-ssh-key

1Skills CLI (Vercel)

npx skills add vince-winkintel/gitlab-cli-skills --skill glab-ssh-key -a claude-code

2Manually: put the files in place

~/.claude/skills/glab-ssh-key/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/glab-ssh-key/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about glab-ssh-key

How do I install glab-ssh-key in Claude Code?

Run npx skills add vince-winkintel/gitlab-cli-skills --skill glab-ssh-key -a claude-code. The skill file is located at ~/.claude/skills/glab-ssh-key/SKILL.md.

What does glab-ssh-key do?

It helps add, inspect, list, and delete SSH keys on a GitLab account. The list and get commands support JSON output.

What does glab-ssh-key need to work?

It requires the glab CLI and an authenticated GitLab account. Key uploads should use a public key; uploading a private key exposes credentials.

Source text

SKILL.md · MIT
---
name: glab-ssh-key
description: Manage SSH keys for GitLab account including add, list, and delete operations. Use when setting up SSH authentication, managing SSH keys, or configuring Git over SSH. Triggers on SSH key, add SSH key, SSH authentication, Git SSH.
---

# glab ssh-key

> **Help provenance.** Each adjacent marker selects its matching source commit and archive SHA-256 below (checksum-verified official macOS arm64 binary). Preserve complete help bytes except trailing spaces/tabs, including casing, spelling, blank lines, indentation, examples, wrapping, and truncation. Historical keys do not override current markers.
> - `2e352a17e`: `2e352a17e7e00bef420b0f38e0ce9ab4e1a38e5d`; `017b14c9bb8d54ba1ea2007607f86dbde0352ad8dea566e2647e9c1bae86bcac`.

## Overview

<!-- help-capture: 2e352a17e:2a3d30b813c3 -->

```text

  Add, list, get, and delete the SSH keys associated with your account.

  GitLab uses SSH keys to authenticate Git operations over SSH, and,
  depending on each key's usage type, to verify signed commits.


  USAGE

    glab ssh-key <command> [command] [--flags]

  COMMANDS

    add [key-file] [--flags]     Add an SSH key to your GitLab account.
    delete [<key-id>] [--flags]  Deletes a single SSH key specified by the ID.
    get [<key-id>] [--flags]     Returns a single SSH key specified by the ID.
    list [--flags]               Get a list of SSH keys for the currently authenticated user.

  FLAGS

    -h --help                    Show help for this command.
    -R --repo                    Select another repository. You can use either OWNER/REPO or GROUP/NAMESPACE/REPO. The full URL or Git URL is also accepted.

```

## ⚠️ Security Warning: Public Keys Only

**Always verify you are uploading a PUBLIC key, not a private key.**

- ✅ Public keys: `~/.ssh/id_rsa.pub`, `~/.ssh/id_ed25519.pub` (`.pub` extension)
- ❌ Private keys: `~/.ssh/id_rsa`, `~/.ssh/id_ed25519` (no extension — NEVER upload these)

Uploading a private key to GitLab would expose your credentials. Double-check the filename before running `glab ssh-key add`.

```bash
# ✅ Safe — public key
glab ssh-key add ~/.ssh/id_ed25519.pub --title "My Laptop"

# ❌ NEVER do this — private key
# glab ssh-key add ~/.ssh/id_ed25519 --title "My Laptop"
```

**Before uploading, verify your key is public:**
```bash
# Should start with 'ssh-rsa', 'ssh-ed25519', 'ecdsa-sha2-*', etc.
head -c 20 ~/.ssh/id_ed25519.pub
```

## Quick start

```bash
glab ssh-key --help
```

## Replace an existing key

GitLab rejects duplicate public-key fingerprints even when the registered key has expired. After confirming the authenticated account and the key to replace, use:

```bash
glab ssh-key add ~/.ssh/id_ed25519.pub --title "My Laptop" --expires-at 2027-01-01 --replace
```

`--expires-at` accepts both a date-only value such as `2027-01-01` (midnight UTC) and a full RFC 3339 timestamp such as `2027-01-01T00:00:00Z`. The flag help shows the full timestamp form; the date-only example above is also accepted by the CLI parser.

`--replace` parses the public key, searches the current user's keys across pages for the same SHA256 fingerprint, deletes the match, and adds the supplied key with the requested title, usage type, and expiration. With no match it adds the key normally. There is no replacement confirmation prompt or rollback: if adding fails after deletion, the old key is already gone. Review the matching key before using this flag and keep another authorized access method available. This re-registers the same public key; it does not generate or rotate key material.

## Shell completion

`ssh-key get` and `delete` complete the first argument with current-account key IDs and titles through an authenticated API lookup. Completion is therefore not offline discovery or authorization to delete a key. `add` completes file paths without restricting them to `.pub`; verify that the selected file is a public key before uploading. `--usage-type` completes `auth`, `signing`, and `auth_and_signing`. Help inspection does not exercise those completions.

## Structured output

`glab ssh-key list` and `glab ssh-key get` support `--output json` / `-F json` for structured output, which is useful for agent automation.

```bash
# List SSH keys with JSON output
glab ssh-key list --output json
glab ssh-key list -F json

# Get a specific SSH key with JSON output
glab ssh-key get <key-id> --output json
glab ssh-key get <key-id> -F json
```

## Subcommands

See [references/commands.md](references/commands.md) for full `--help` output.

© vince-winkintel · MIT · vince-winkintel/gitlab-cli-skills

Similar skills

All skills for DevOps and infrastructure →

From the same set45

The whole set →
glab-completion This Claude Code skill generates glab completion scripts for bash, zsh, fish, and PowerShell. It activates when configuring shell command suggestions. CX Codex +1 117installs glab-orbit The glab-orbit Claude Code skill runs Orbit CLI through glab. It activates for remote GitLab graph queries and searches across a local code graph. CX Codex +1 117installs glab-duo The glab-duo Claude Code skill installs and runs GitLab Duo CLI through glab. It activates for terminal access to GitLab Duo Agent Platform, interactive sessions, or a bounded headless task. CX Codex +1 116installs glab-deploy-key The glab-deploy-key Claude Code skill manages SSH deploy keys for GitLab projects. It activates for CI/CD access setup and project key operations. CX Codex +1 116installs glab-snippet The glab-snippet Claude Code skill creates GitLab snippets from files or stdin text. It activates when a request is to share code or text as a new snippet. CX Codex +1 115installs glab-todo The glab-todo Claude Code skill manages GitLab to-dos through the CLI. It lists assigned or mentioned work and marks selected items as done. CX Codex +1 115installs glab-milestone The glab-milestone Claude Code skill manages GitLab milestones, from creating and editing them to listing, viewing, and deleting them. It activates for release planning and milestone progress tasks. CX Codex +1 114installs glab-iteration glab-iteration — a skill for Claude Code and Codex that manages GitLab iterations. It activates for sprint planning, issue assignment, and progress checks. CX Codex +1 114installs

Project sponsors

Companies that keep this analytics open