ssh-keyman
v2.0.1
Published
A cli tool to manage multiple ssh keys and switch between different ssh keys with ease & grace.
Maintainers
Readme
ssh-keyman
A sophisticated key manager cli tool to manage multiple ssh keys and switch between different ssh keys with ease & grace.
CI/CD Status
| Workflow | Status |
|----------|--------|
| Build & Test | |
| Test Coverage |
|
| NPM Publish |
|
Platform Support
Tests run automatically on:
- ✅ Ubuntu (Linux) - Node.js 16.x, 18.x, 20.x
- ✅ macOS - Node.js 16.x, 18.x, 20.x
- ✅ Windows - Node.js 16.x, 18.x, 20.x
35 Tests | 75%+ Coverage | All Platforms Passing
Overview
Normally people have difficulty managing different ssh keys for different Github / Bitbucket / Gitlab accounts. This package makes your life easier by creating different ssh profiles & manage them for you. So you can concentrate on your work.
Installation
npm install -g ssh-keymanUsage
➜ ~ ssh-keyman -h
SSH KeyMan - SSH Key Environment Manager
Usage: ssh-keyman <command> [options]
Commands:
-i Initialize keyman directory and default environment
-c [name] Create new ssh environment (interactive if no name)
-s [name] Switch to another ssh environment (interactive if no name)
-d [name] Delete ssh environment (interactive if no name)
-ls List all environments
-h Show help
-v Show version
Tip: Run commands without arguments for interactive mode✨ New Interactive Features
ssh-keyman now supports interactive mode with autocomplete! Simply run commands without arguments to get an enhanced interactive experience:
ssh-keyman -s- Interactive environment switcher with autocompletessh-keyman -c- Interactive environment creator with validationssh-keyman -d- Interactive environment deletion with confirmation
Initialisation
Calling ssh-keyman -i creates a ~/.sshkeyman/ directory if it doesn't exist,
and copies your current ~/.ssh as the 'default' ssh profile.
➜ ~ ssh-keyman -i
🔑 Initializing SSH KeyMan...
✓ Created ssh-keyman directory: /Users/shahidullahkhan/.sshkeyman
✓ Created default environment
✓ Activated 'default' environment
✨ SSH KeyMan initialized successfully!Create a new ssh environment
With environment name:
➜ ~ ssh-keyman -c newenvironment
✓ Saved current ssh config to default
✓ Created directory for new environment: /Users/shahidullahkhan/.sshkeyman/newenvironment
? Do you want to switch to newly created environment (newenvironment)? (Y/n) y
✓ Activated environment 'newenvironment'Interactive mode (just run without name):
➜ ~ ssh-keyman -c
? Enter name for the new environment: production
✓ Saved current ssh config to default
✓ Created directory for new environment: /Users/shahidullahkhan/.sshkeyman/production
? Do you want to switch to newly created environment (production)? (Y/n) A blank environment will be created. Then modify content of ~/.ssh/. Then whenever you will switch to another environment, your changes will be saved.
List available ssh environments
➜ ~ ssh-keyman -ls
Available environments:
• default
✓ newenvironment (active)Switch to a specific ssh environment
With environment name:
➜ ~ ssh-keyman -s default
✓ Saved current ssh config to 'newenvironment'
✓ Activated environment 'default'Interactive mode with autocomplete (just run without name):
➜ ~ ssh-keyman -s
? Select environment to switch to: (Use arrow keys or type to search)
❯ default
production
stagingStart typing to filter environments with autocomplete!
Delete a specific ssh environment
With environment name:
➜ ~ ssh-keyman -d newenvironment
✓ Successfully deleted environment 'newenvironment'Interactive mode with autocomplete and confirmation (just run without name):
➜ ~ ssh-keyman -d
? Select environment to delete: (Use arrow keys or type to search)
❯ newenvironment
staging
? Are you sure you want to delete environment 'newenvironment'? (y/N) y
✓ Successfully deleted environment 'newenvironment'Get the current ssh-keyman version
➜ ~ ssh-keyman -v
ssh-keyman version 1.0.2Development
Running Tests
# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Run tests with coverage
npm run test:ciProject Structure
ssh-keyman/
├── src/
│ ├── __tests__/ # Test files
│ ├── cli.js # CLI entry point
│ ├── cliOptions.js # CLI argument parsing
│ ├── commands.js # Command implementations
│ ├── constants.js # Constants and configuration
│ └── extendFs.js # File system utilities
├── .github/
│ └── workflows/ # GitHub Actions CI/CD
├── index.js # Main entry point
└── package.jsonContributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
ISC, a permissive free software license published by the Internet Software Consortium.
Contact
- GitHub (shahidullahkhan)
- Email ([email protected])
Made with ❤️ by Shahid Ullah Khan from Pakistan.
