gitsm
v2.0.2
Published
Git SSH Key Manager - Seamless SSH key management for repository
Maintainers
Readme
Git SSH Key Manager (gitsm)
🔐 SSH Key Management for Git, Simplified.
gitsm is a powerful Git wrapper that automatically configures different SSH keys for different repositories. No more editing ~/.ssh/config, just clone and go.
Overview
- Do you use multiple GitHub or GitLab accounts?
- Do you need to use different SSH keys for different projects?
- Are you tired of editing
.git/configor~/.ssh/configby hand? - Do you want a cross-platform solution that "just works" on Windows, macOS, and Linux?
gitsm is the solution you need.
Demo

Demonstration: Repository cloning with interactive SSH key selection and automatic configuration.
Features
- Auto-discovery: Automatic detection of SSH keys in your
~/.sshdirectory - Per-repository Configuration: Each repository can use a different SSH key
- Smart Cloning: Interactive SSH key selection during clone operations
- Repository Management: Commands to fix, convert, and manage repositories
- Key Management: List and validate SSH keys across your system
- Security: Built-in SSH key testing and validation
- State Management: Persistent configuration storage
- Branch Operations: Safe branch switching with state preservation
- Cross-platform: Full support for Windows, macOS, and Linux
Installation
npm install -g gitsmGetting Started
1. Clone a Repository
Run gitsm clone instead of git clone.
gitsm clone [email protected]:username/repo.gitgitsm will prompt you to select an SSH key from your ~/.ssh directory. It then clones the repository and automatically configures it to use that key for all future Git operations (pull, push, fetch, etc.).
2. Use Git as Usual
Once cloned, you can use standard Git commands inside the repository.
cd repo
git pull
git push3. List Managed Repositories
See all repositories configured with gitsm.
gitsm list repos4. Fix a Repository's SSH Config
If you move your SSH keys or encounter a path error, gitsm fix can repair the configuration.
gitsm fix /path/to/your/repoUsage
Command Reference
| Command | Description | Options | Example |
|---------|-------------|----------|---------|
| clone | Clone a repository with SSH key selection | --dir <directory>: Target directory | gitsm clone [email protected]:user/repo.git |
| switch | Safely switch branches with stash handling | --force: Force switch with changes--no-pull: Skip pulling updates--create: Create new branch | gitsm switch feature-branch |
| convert | Convert existing repo to use gitsm | [repoPath]: Path to repository(defaults to current directory) | gitsm convert ~/projects/myrepo |
| list keys | Show available SSH keys | None | gitsm list keys |
| list repos | Show gitsm-managed repositories | None | gitsm list repos |
| fix | Repair SSH configuration | <repoPath>: Repository path | gitsm fix ~/projects/myrepo |
| upgrade | Update gitsm to latest version | None | gitsm upgrade |
| help | Show command help | [command]: Show help for specific command | gitsm help switch |
Prerequisites
- Node.js: Version 16.x or higher.
- Git: Must be installed and available in your system's PATH.
- SSH Directory: Must have a
.sshdirectory in your home folder:- Unix/Linux/macOS:
~/.ssh - Windows:
C:\Users\YourUsername\.ssh
- Unix/Linux/macOS:
- SSH Keys: SSH keys must be in the root of your
.sshdirectory (not in subdirectories)- Example:
~/.ssh/id_rsa,~/.ssh/id_ed25519 - Public keys must have
.pubextension:id_rsa.pub,id_ed25519.pub
- Example:
License
This project is licensed under the MIT License.
Contributing
Contributions are welcome! Please feel free to open an issue or submit a pull request. Whether it's a bug report, feature request, or documentation improvement, all contributions are appreciated.
Made with ❤️ for developers who juggle multiple SSH keys.
