Skip to content
DocsAll docs
Console

SSH keys

Add and remove the SSH and signing keys of your account.

Last updated

On this page

Description and operation

General

Keys belong to your account, not to a team or a workspace. Every team where you are an active member accepts them. You add only the public half; its SHA-256 fingerprint is the key's _id.

KindUsed forGives access
SSH keyGit over SSH.Yes.
Signing keyVerified commits. An SSH key or an OpenPGP signing key.No.

One SSH key can be both an SSH key and a signing key; these are two entries. A key without a name takes the key's comment.

Tasks

Add an SSH key

Reason for the task: Clone and push over SSH.

Job set-up

Procedure

  1. Copy your public key line, for example from ~/.ssh/id_ed25519.pub.

  2. Add the key. Set key to the line from step 1.

    Python
    from kloudlite import Kloudlitekl = Kloudlite()k = kl.request("POST", "/v1/keys", body={"name": "laptop", "key": "ssh-ed25519 AAAA... you@laptop"})print(k["_id"])
    TypeScript
    import { Kloudlite } from "./index.ts";const kl = new Kloudlite();const k = (await kl.request("POST", "/v1/keys", { name: "laptop", key: "ssh-ed25519 AAAA... you@laptop" })) as { _id: string };console.log(k._id);
    Go
    kl := kloudlite.New(kloudlite.Options{})var k map[string]anyerr := kl.Request("POST", "/v1/keys", kloudlite.RequestOptions{    Body: map[string]any{"name": "laptop", "key": "ssh-ed25519 AAAA... you@laptop"},    Out:  &k,})if err != nil {    log.Fatal(err)}fmt.Println(k["_id"])
    Ruby
    require_relative "kloudlite"kl = Kloudlite::Client.newputs kl.request("POST", "/v1/keys", body: { name: "laptop", key: "ssh-ed25519 AAAA... you@laptop" })["_id"]
    Java
    var kl = new Kloudlite();System.out.println(kl.request(new Kloudlite.RawRequest().method("POST").path("/v1/keys")    .body("{\"name\":\"laptop\",\"key\":\"ssh-ed25519 AAAA... you@laptop\"}")));
    CLI
    kloudlite request POST /v1/keys --body '{"name": "laptop", "key": "ssh-ed25519 AAAA... you@laptop"}'

Close-out

  1. Make sure that the _id equals the fingerprint from ssh-keygen -lf ~/.ssh/id_ed25519.pub.

Add a signing key

Reason for the task: Show your commits as verified.

Job set-up

Procedure

  1. Set git to sign with SSH. Skip this step for an OpenPGP key.

    CLI
    git config gpg.format ssh
  2. Add the key with signing set to true. For OpenPGP, set key to the output of gpg --armor --export.

    Python
    kl.request("POST", "/v1/keys", body={"name": "laptop signing", "key": "ssh-ed25519 AAAA... you@laptop", "signing": True})
    TypeScript
    await kl.request("POST", "/v1/keys", { name: "laptop signing", key: "ssh-ed25519 AAAA... you@laptop", signing: true });
    Go
    err := kl.Request("POST", "/v1/keys", kloudlite.RequestOptions{    Body: map[string]any{"name": "laptop signing", "key": "ssh-ed25519 AAAA... you@laptop", "signing": true},})if err != nil {    log.Fatal(err)}
    Ruby
    kl.request("POST", "/v1/keys", body: { name: "laptop signing", key: "ssh-ed25519 AAAA... you@laptop", signing: true })
    Java
    kl.request(new Kloudlite.RawRequest().method("POST").path("/v1/keys")    .body("{\"name\":\"laptop signing\",\"key\":\"ssh-ed25519 AAAA... you@laptop\",\"signing\":true}"));
    CLI
    kloudlite request POST /v1/keys --body '{"name": "laptop signing", "key": "ssh-ed25519 AAAA... you@laptop", "signing": true}'

Close-out

  1. Show your signing keys with kind=signing as in task 003. Make sure that the new _id starts with sign:.

Show your keys

Reason for the task: List the keys of your account.

Job set-up

Procedure

  1. Show the keys. Add the query kind=signing to show signing keys instead.

    Python
    for k in kl.request("GET", "/v1/keys"):    print(k["_id"], k["name"])
    TypeScript
    const keys = (await kl.request("GET", "/v1/keys")) as { _id: string; name: string }[];for (const k of keys) console.log(k._id, k.name);
    Go
    var keys []map[string]anyif err := kl.Request("GET", "/v1/keys", kloudlite.RequestOptions{Out: &keys}); err != nil {    log.Fatal(err)}for _, k := range keys {    fmt.Println(k["_id"], k["name"])}
    Ruby
    kl.request("GET", "/v1/keys").each { |k| puts "#{k["_id"]} #{k["name"]}" }
    Java
    System.out.println(kl.request("GET", "/v1/keys"));
    CLI
    kloudlite request GET /v1/keys

Close-out

  1. Make sure that each key in the list is still in use.

Remove a key

Reason for the task: Revoke a key that you no longer use.

Job set-up

CAUTION

A removed key stops working for git over SSH at once.

Procedure

  1. Find the _id of the key as in task 003.

  2. Remove the key. Replace SHA256:ID with its _id.

    Python
    kl.request("DELETE", "/v1/keys/SHA256:ID")
    TypeScript
    await kl.request("DELETE", "/v1/keys/SHA256:ID");
    Go
    if err := kl.Request("DELETE", "/v1/keys/SHA256:ID", kloudlite.RequestOptions{}); err != nil {    log.Fatal(err)}
    Ruby
    kl.request("DELETE", "/v1/keys/SHA256:ID")
    Java
    kl.request("DELETE", "/v1/keys/SHA256:ID");
    CLI
    kloudlite request DELETE /v1/keys/SHA256:ID

Close-out

  1. Show the keys. Make sure that the _id is gone.

Troubleshooting

SymptomPossible causeCorrective action
400 with keys belong to you, not to a namespaceThe body contains owner.Remove owner from the body.
400 with a GPG key can only be added as a signing keyAn OpenPGP key was sent without signing.Add it as a signing key. See task 002.
409 with that key is already addedThe key is already on the account as this kind.No action needed.
404 with no such credentialThe _id is not one of your keys.Copy the _id again. See task 003.
502 with could not read the keyA transient platform error.Send the request again.