Skip to Content
New to Genbox? Check out our Getting Started guide
Commandscleanup-ssh

gb cleanup-ssh

Remove SSH config entries for genboxes that no longer exist.

Synopsis

gb cleanup-ssh [options]

Description

Cleans up orphaned SSH config entries from your ~/.ssh/config file. When genboxes are destroyed, their SSH config entries may remain. This command removes entries for genboxes that no longer exist on the server.

Options

OptionDescription
-q, --quietOnly output if entries were removed

Examples

Clean Up Orphaned Entries

gb cleanup-ssh
Checking for orphaned SSH configs... Found 5 SSH config entries, checking against API... âś“ Cleaned up 2 orphaned SSH configs Removed entries for: - old-project - test-feature

No Orphaned Entries

gb cleanup-ssh
âś“ No orphaned SSH configs found 5 SSH config entries are all valid

Quiet Mode

gb cleanup-ssh --quiet

Only produces output if entries were actually removed.

What It Does

  1. Scans SSH config: Reads ~/.ssh/config for genbox entries
  2. Fetches active genboxes: Queries API for your current genboxes
  3. Compares: Finds SSH entries that don’t match any active genbox
  4. Removes orphans: Deletes entries for terminated/non-existent genboxes

SSH Config Entries

Genbox adds entries like this to your SSH config:

# genbox:my-app Host genbox-my-app HostName 5.161.xxx.xxx User dev IdentityFile ~/.ssh/id_ed25519 StrictHostKeyChecking no

When my-app is destroyed, this entry becomes orphaned.

When to Use

  • After destroying multiple genboxes
  • If your SSH config has grown large
  • Before running ssh tab completion to avoid stale entries
  • As periodic maintenance

Notes

  • Only removes entries for terminated genboxes
  • Keeps entries for genboxes in any active state (running, stopped, error, provisioning)
  • Requires authentication to check against API
  • Safe to run multiple times

See Also

Last updated on