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
| Option | Description |
|---|---|
-q, --quiet | Only output if entries were removed |
Examples
Clean Up Orphaned Entries
gb cleanup-sshChecking for orphaned SSH configs...
Found 5 SSH config entries, checking against API...
âś“ Cleaned up 2 orphaned SSH configs
Removed entries for:
- old-project
- test-featureNo Orphaned Entries
gb cleanup-sshâś“ No orphaned SSH configs found
5 SSH config entries are all validQuiet Mode
gb cleanup-ssh --quietOnly produces output if entries were actually removed.
What It Does
- Scans SSH config: Reads
~/.ssh/configfor genbox entries - Fetches active genboxes: Queries API for your current genboxes
- Compares: Finds SSH entries that don’t match any active genbox
- 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 noWhen my-app is destroyed, this entry becomes orphaned.
When to Use
- After destroying multiple genboxes
- If your SSH config has grown large
- Before running
sshtab 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
gb destroy- Delete genboxgb list- List all genboxesgb doctor- Diagnose CLI issues
Last updated on