{"id":42743017,"url":"https://github.com/odanilosalve/ssh-manager","last_synced_at":"2026-01-29T19:02:56.794Z","repository":{"id":334412029,"uuid":"1107132129","full_name":"odanilosalve/ssh-manager","owner":"odanilosalve","description":"SSH Manager is a powerfull tool write in shell from managers my SSH Keys using simple commands in my terminal.","archived":false,"fork":false,"pushed_at":"2026-01-24T17:38:03.000Z","size":35,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-25T04:43:23.319Z","etag":null,"topics":["shell-script","ubuntu"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/odanilosalve.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-30T16:33:38.000Z","updated_at":"2026-01-24T17:38:08.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/odanilosalve/ssh-manager","commit_stats":null,"previous_names":["odanilosalve/ssh-manager"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/odanilosalve/ssh-manager","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/odanilosalve%2Fssh-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/odanilosalve%2Fssh-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/odanilosalve%2Fssh-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/odanilosalve%2Fssh-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/odanilosalve","download_url":"https://codeload.github.com/odanilosalve/ssh-manager/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/odanilosalve%2Fssh-manager/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28882624,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-29T16:41:59.663Z","status":"ssl_error","status_checked_at":"2026-01-29T16:39:39.641Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["shell-script","ubuntu"],"created_at":"2026-01-29T19:02:56.686Z","updated_at":"2026-01-29T19:02:56.789Z","avatar_url":"https://github.com/odanilosalve.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ssh-manager\n\n`ssh-manager` is a small CLI utility to manage and switch between multiple SSH keys for GitHub on a single machine.\n\nIt works by:\n\n* Keeping a registry of SSH keys identified by **aliases**.\n* Setting one alias as **active**.\n* Pointing a symlink (`~/.ssh/github_current`) to the active key.\n* Letting your SSH config use this symlink for all connections to `github.com`.\n\nThis way you can jump between personal and work GitHub accounts with a single command.\n\n---\n\n## Requirements\n\n* Linux environment (tested on Ubuntu).\n* OpenSSH client (`ssh`).\n* `~/.local/bin` on your `PATH` (or another directory on `PATH` where you place the script).\n* SSH keys already generated (e.g. `~/.ssh/personal`, `~/.ssh/work`, etc.).\n\n---\n\n## Installation\n\n### Quick Install (Recommended)\n\n1. Clone the repository:\n\n   ```bash\n   git clone https://github.com/odanilosalve/ssh-manager.git\n   cd ssh-manager\n   ```\n\n2. Run the installation script:\n\n   ```bash\n   ./install.sh\n   ```\n\n   This will:\n   - Copy the project to `~/.local/lib/ssh-manager/`\n   - Create a symlink `~/.local/bin/ssh-manager` pointing to the script\n   - Make the script executable\n   - Warn if `~/.local/bin` is not in your PATH\n\n3. Ensure `~/.local/bin` is on your `PATH`.\n   If not, add this to your shell config (`~/.bashrc`, `~/.zshrc`, etc.):\n\n   ```bash\n   export PATH=\"$HOME/.local/bin:$PATH\"\n   ```\n\n   Then reload your shell or run:\n   ```bash\n   source ~/.bashrc  # or source ~/.zshrc\n   ```\n\n### Manual Install\n\n1. Clone or download this repository:\n\n   ```bash\n   git clone https://github.com/odanilosalve/ssh-manager.git\n   cd ssh-manager\n   ```\n\n2. Copy the entire project to a directory on your `PATH`:\n\n   ```bash\n   cp -r . ~/.local/bin/ssh-manager\n   chmod +x ~/.local/bin/ssh-manager/ssh-manager\n   ```\n\n   Or create a symlink:\n\n   ```bash\n   ln -s \"$(pwd)\" ~/.local/bin/ssh-manager\n   ```\n\n3. Ensure `~/.local/bin` is on your `PATH` (see step 3 above).\n\n   **Note**: The `ssh-manager` script requires the `lib/` directory to be in the same directory as the script.\n\n---\n\n## SSH configuration\n\nConfigure SSH to always use the *current* key for GitHub:\n\n```sshconfig\n# ~/.ssh/config\nHost github.com\n    HostName github.com\n    User git\n    IdentityFile ~/.ssh/github_current\n    IdentitiesOnly yes\n```\n\n* `ssh-manager key use \u003calias\u003e` will update the symlink `~/.ssh/github_current`.\n* Every `git clone`, `git fetch`, `git push`, etc. that uses `git@github.com:...`\n  will automatically use the active key.\n\n---\n\n## Quick start\n\n1. Register your keys:\n\n   ```bash\n   ssh-manager key add personal ~/.ssh/personal\n   ssh-manager key add work     ~/.ssh/work\n   ```\n\n2. Activate one key (for example, personal):\n\n   ```bash\n   ssh-manager key use personal\n   ```\n\n3. Test the connection:\n\n   ```bash\n   ssh-manager key test\n   # or\n   ssh-manager key test personal\n   ```\n\n4. Use Git as usual:\n\n   ```bash\n   git clone git@github.com:odanilosalve/ssh-manager.git\n   ```\n\n5. When you want to switch to the work account:\n\n   ```bash\n   ssh-manager key use work\n   ssh-manager key test\n   git clone git@github.com:YOUR_WORK_ORG/some-repo.git\n   ```\n\n---\n\n## Command-line reference\n\n### Global usage\n\n```bash\nssh-manager [OPTIONS] \u003ccommand\u003e [subcommand] [args...]\n```\n\nGlobal options:\n\n* `-h`, `--help` – Show help.\n* `-V`, `--version` – Show version.\n\nMain command group:\n\n* `key` – Manage SSH keys known by `ssh-manager`.\n\n---\n\n### `key list`\n\n```bash\nssh-manager key list\nssh-manager key list --system\n```\n\n* `ssh-manager key list`\n  Shows keys registered in the `ssh-manager` registry.\n  The active key is marked with `*`.\n\n* `ssh-manager key list --system`\n  Lists physical SSH public keys found in `~/.ssh/*.pub` and their matching private keys if present.\n\n---\n\n### `key add`\n\n```bash\nssh-manager key add \u003calias\u003e \u003cprivate_key_path\u003e\n```\n\nRegisters a new key in the internal registry.\n\n* `\u003calias\u003e`\n  Name to identify this key (e.g. `personal`, `work`).\n  Allowed characters: letters, digits, `-`, `_`.\n\n* `\u003cprivate_key_path\u003e`\n  Path to the private key file (e.g. `~/.ssh/personal`).\n\nExamples:\n\n```bash\nssh-manager key add personal ~/.ssh/personal\nssh-manager key add work     ~/.ssh/work\n```\n\nIf the alias already exists or the file does not exist, the command exits with an error.\n\n---\n\n### `key use`\n\n```bash\nssh-manager key use \u003calias\u003e\n```\n\nSets the given alias as the **active** key:\n\n* Validates that the alias exists in the registry.\n\n* Validates that the private key file exists.\n\n* Updates the symlink:\n\n  ```text\n  ~/.ssh/github_current -\u003e \u003cpath_of_the_selected_key\u003e\n  ```\n\n* Saves the active alias in:\n\n  ```text\n  ~/.ssh/github-current-alias\n  ```\n\n* Optionally calls `ssh-add` for the selected key (if `ssh-add` is available).\n\nExample:\n\n```bash\nssh-manager key use personal\n```\n\n---\n\n### `key current`\n\n```bash\nssh-manager key current\n```\n\nDisplays information about the active key:\n\n* Current alias.\n* Path to the key.\n* Symlink status (`~/.ssh/github_current`).\n\nExample output:\n\n```text\nCurrent alias: personal\nKey path: /home/user/.ssh/personal\nSymlink: /home/user/.ssh/github_current -\u003e /home/user/.ssh/personal\n```\n\n---\n\n### `key test`\n\n```bash\nssh-manager key test\nssh-manager key test \u003calias\u003e\n```\n\nTests the SSH connection to GitHub using:\n\n* The **specified alias**, or\n* The **current active key** (if no alias is given).\n\nIt runs:\n\n```bash\nssh -T -o IdentitiesOnly=yes -i \u003ckey_path\u003e \u003cuser\u003e@\u003chost\u003e\n```\n\nDefaults:\n\n* `host`: `github.com` (can be changed via `GITHUB_SSH_HOST`).\n* `user`: `git` (can be changed via `GITHUB_SSH_USER`).\n\nExamples:\n\n```bash\nssh-manager key test\nssh-manager key test personal\nssh-manager key test work\n```\n\nOn success you should see something like:\n\n```text\nRunning: ssh -T git@github.com\nHi USERNAME! You've successfully authenticated, but GitHub does not provide shell access.\n```\n\n---\n\n## Testing\n\nThe project includes comprehensive test coverage using [bats-core](https://github.com/bats-core/bats-core).\n\nTo run the tests:\n\n```bash\nbats tests/ssh-manager.bats\n```\n\nAll 34 tests should pass, covering all functions, error cases, and edge cases.\n\n---\n\n## Environment variables\n\nOptional variables:\n\n* `GITHUB_SSH_HOST`\n  SSH host. Default: `github.com`\n\n* `GITHUB_SSH_USER`\n  SSH user. Default: `git`\n\nThese affect only the `key test` command. Normal Git commands still follow your `~/.ssh/config`.\n\nExample:\n\n```bash\nGITHUB_SSH_HOST=github.com GITHUB_SSH_USER=git ssh-manager key test personal\n```\n\n---\n\n## Internal files\n\n`ssh-manager` uses the following files in `~/.ssh`:\n\n* `github-keys.conf`\n  Registry of aliases and key paths.\n  Format (one entry per line):\n\n  ```text\n  alias;/full/path/to/private/key\n  ```\n\n* `github-current-alias`\n  Contains only the current alias (e.g. `personal`).\n\n* `github_current`\n  Symlink pointing to the active private key.\n  This is the file that should be referenced in your `~/.ssh/config`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fodanilosalve%2Fssh-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fodanilosalve%2Fssh-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fodanilosalve%2Fssh-manager/lists"}