English | 简体中文
A simple and easy-to-use SSH key management CLI tool that helps you easily manage and switch between multiple SSH key pairs.
- 🖥️ Interactive GUI - Run
ssh-keys guito display a visual selection interface - 🌍 Multi-language Support - Automatically detects system language, supports Chinese and English
- 📋 List all managed SSH key pairs
- 🔑 Quickly generate new SSH key pairs
- 🔄 Switch between different SSH keys with one command
- ✏️ Rename existing key pairs
- 💾 Automatically backup unmanaged keys
- 🎯 Clearly display the currently active key
npm install -g ssh-keysRun the GUI command to display an interactive interface:
ssh-keys guiThis will display an interactive interface listing all key pairs:
- Use
↑↓arrow keys to select a key - Press
Enterto switch to the selected key - Press
qorESCto exit - The currently active key is marked with a green ●
ssh-keys list
# Or use the alias
ssh-keys lsExample output:
Available SSH key pairs:
* work (current)
personal
github
Total 3 key pair(s)
ssh-keys gen <name>Examples:
# Generate a key pair named work
ssh-keys gen work
# Generate a key pair with a specific email
ssh-keys gen personal --email your@email.com
# Generate a key pair without auto-switching
ssh-keys gen github --no-switchssh-keys use <name>Example:
# Switch to the personal key pair
ssh-keys use personalssh-keys rename <old-name> <new-name>Example:
# Rename work to company
ssh-keys rename work companyIf you rename the currently active key pair, the tool will automatically update the keys in the ~/.ssh/ directory.
Display the current public key for easy copying:
ssh-keys showThis will display your current SSH public key, which you can copy and add to GitHub, GitLab, or other platforms.
Enable random identity mode to hide your real user information in git commits:
# Check current status
ssh-keys rand
# Enable random identity mode
ssh-keys rand on
# Disable random identity mode
ssh-keys rand offWhen enabled, you can use these git aliases:
git radd . # Add files with random identity
git rcommit -m "msg" # Commit with random identityEach commit will use a different random username and email, protecting your privacy.
The tool automatically detects your system language and supports both Chinese and English. You can also manually switch languages:
# Show current language
ssh-keys lang
# Switch to English
ssh-keys lang en-US
# Switch to Chinese
ssh-keys lang zh-CN
# Or use the global option
ssh-keys --lang zh-CN listSupported languages:
en-US- Englishzh-CN- Simplified Chinese (简体中文)
- All key pairs are stored in the
~/.ssh-keys/directory, with each key pair in its own subdirectory - When switching keys, the selected key pair is copied to the
~/.ssh/directory - If an unmanaged key is detected in
~/.ssh/, it will be automatically backed up
~/.ssh-keys/
├── work/
│ ├── id_rsa
│ └── id_rsa.pub
├── personal/
│ ├── id_rsa
│ └── id_rsa.pub
└── github/
├── id_rsa
└── id_rsa.pub
- Keys are generated using RSA 4096-bit encryption by default
- Switching keys will overwrite
~/.ssh/id_rsaand~/.ssh/id_rsa.pub - It's recommended to ensure your current key is saved before switching
MIT