Stop editing
~/.ssh/configmanually.
gitkey is a CLI for managing SSH keys and Git profiles.
It helps you work with multiple GitHub and Bitbucket accounts without manually juggling SSH config, remotes, and agent state.
- Why
- Features
- Requirements
- Installation
- Usage
- Example
- Zsh Prompt Integration
- Development
- Limitations
- Roadmap
- Contributing
If you use multiple Git accounts across work, personal projects, or different providers, you have probably hit at least one of these:
Permission denied (publickey)- the wrong SSH key is being used
- manual edits in
~/.ssh/config - confusing
ssh-agentstate
gitkey gives you a small CLI to manage that workflow in one place.
- Manage SSH profiles from
~/.ssh/config - Clone repositories with profile selection
- Switch the SSH profile used by an existing repo
- Show the active SSH profile for the current repository
- Diagnose SSH setup with
doctor - Auto-fix common permission issues with
fix - Generate new SSH keys
- Add keys to
ssh-agentand macOS Keychain - Open, reveal, copy, and inspect SSH key files
- Install zsh right-prompt integration
- Node.js
>=20 git- OpenSSH tools such as
ssh,ssh-add, andssh-keygen zshif you want prompt integration- macOS for the best supported experience today
npm install -g @bagdevich/gitkeyList SSH profiles:
gitkey listClone a repository with a selected SSH profile:
gitkey clone git@github.com:org/repo.gitSwitch SSH profile in the current repository:
gitkey useSwitch a specific remote:
gitkey use originShow current SSH profile:
gitkey statusPrompt-friendly output:
gitkey status --promptRun diagnostics:
gitkey doctorFix common SSH issues:
gitkey fixAdd a key to ssh-agent:
gitkey agent-addGenerate a new SSH key:
gitkey generateTest an SSH connection:
gitkey testOpen a public key file:
gitkey open
gitkey open --currentOpen a private key file explicitly:
gitkey open --privateReveal a key in Finder:
gitkey reveal
gitkey reveal --pubReveal a private key in Finder explicitly:
gitkey reveal --privateCopy a public key to clipboard:
gitkey copy-pub
gitkey copy-pub --currentPrint a public key:
gitkey show
gitkey show --currentPrint a private key explicitly:
gitkey show --privateGiven this SSH config:
Host keyName
HostName github.com
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/keyNamegit
IdentitiesOnly yesInstead of:
git clone git@github.com:org/repo.gitYou can run:
gitkey clone git@github.com:org/repo.gitSelect:
keyName -> github.com ~/.ssh/keyNamegit
And gitkey will execute:
git clone git@keyName:org/repo.gitInstall:
gitkey install-shell
source ~/.zshrcInside a Git repository, your prompt can show:
🔑 keyName
git clone git@github.com:bagdevich/gitkey.git
cd gitkey
npm install
npm test
npm run dev -- listBuild:
npm run build
npm link
gitkey listagent-add,generate,install-shell,open,reveal, andcopy-pubare currently optimized for macOS.- Prompt integration currently targets
zsh. - SSH profiles are expected to be defined in
~/.ssh/config.
- convert HTTPS remotes to SSH
- extended repo info
- test all profiles
- prune unused keys
- Windows support
Pull requests are welcome.
If you find a bug or have an idea, open an issue.