{"id":31971367,"url":"https://github.com/peter-bread/gamon3","last_synced_at":"2026-01-03T20:14:16.188Z","repository":{"id":314320822,"uuid":"1046989746","full_name":"peter-bread/gamon3","owner":"peter-bread","description":"Automatically switch GitHub CLI account on `cd`","archived":false,"fork":false,"pushed_at":"2025-09-19T02:01:09.000Z","size":167,"stargazers_count":1,"open_issues_count":7,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-19T03:42:09.898Z","etag":null,"topics":["cd","cli","git","github","golang","linux","macos","pwd"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/peter-bread.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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-08-29T14:57:05.000Z","updated_at":"2025-09-19T02:01:11.000Z","dependencies_parsed_at":"2025-09-11T21:20:15.659Z","dependency_job_id":"36c93bc4-8f97-44b0-8347-6e1c11e42934","html_url":"https://github.com/peter-bread/gamon3","commit_stats":null,"previous_names":["peter-bread/gamon3"],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/peter-bread/gamon3","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peter-bread%2Fgamon3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peter-bread%2Fgamon3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peter-bread%2Fgamon3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peter-bread%2Fgamon3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peter-bread","download_url":"https://codeload.github.com/peter-bread/gamon3/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peter-bread%2Fgamon3/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279020656,"owners_count":26086897,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["cd","cli","git","github","golang","linux","macos","pwd"],"created_at":"2025-10-14T19:46:45.787Z","updated_at":"2025-12-30T21:07:33.757Z","avatar_url":"https://github.com/peter-bread.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gamon3\n\nAutomatically switch GitHub CLI account on `cd`.\n\n## Requirements\n\n- Linux or MacOS\n- Go 1.25+\n- [`gh`](https://cli.github.com/) v2.40.0+\n\n## Install\n\n### Pre-built Binaries\n\nPre-built binaries can be found under [GitHub Releases](https://github.com/peter-bread/gamon3/releases/latest).\n\nThese can be downloaded and extracted manually.\n\nAlternatively you can use the provided [installation script](./scripts/install). The\ncommands below download the script and pipe it into Bash.\n\n\u003e [!IMPORTANT]\n\u003e\n\u003e Always read through scripts before running them to make sure they aren't malicious.\n\n```bash\ncurl -fsSL https://raw.githubusercontent.com/peter-bread/gamon3/refs/heads/main/scripts/install |\n  bash\n```\n\n```bash\nwget -qO- https://raw.githubusercontent.com/peter-bread/gamon3/refs/heads/main/scripts/install |\n  bash\n```\n\n#### Customise Installation\n\nThe installation script can be configured with some optional flags.\n\nThe command below downloads the script and pipes it into Bash, providing all\noptions with their default values.\n\n```bash\ncurl -fsSL https://raw.githubusercontent.com/peter-bread/gamon3/refs/heads/main/scripts/install |\n  bash -s -- --version latest --ext tar.gz --prefix /usr/local\n```\n\nOptions:\n\n| Option       | Description        | Default      | Allowed Value          |\n| ------------ | ------------------ | ------------ | ---------------------- |\n| `--version`  | Version to install | `latest`     | `latest` or `[v]X.Y.Z` |\n| `--ext`      | Archive extension  | `tar.gz`     | `tar.gz` or `zip`      |\n| `--prefix`   | Install location   | `/usr/local` | Any filepath           |\n| `-h, --help` | Prints help        | N/A          | N/A                    |\n\n### Homebrew\n\n```bash\nbrew install peter-bread/tap/gamon3\n```\n\n### Go Install\n\n```bash\ngo install github.com/peter-bread/gamon3@latest\n```\n\n### Build From Source\n\nTo build and install Gamon3 under the default prefix (`/usr/local`), run:\n\n```bash\ngit clone https://github.com/peter-bread/gamon3\ncd gamon3\nmake\nsudo make install\n```\n\nTo install under a custom prefix, e.g. `~/.local`, run:\n\n```bash\nmake install PREFIX=~/.local\n```\n\n## Usage\n\n### Authenticate with GH CLI\n\nBefore using Gamon3, you will need to [authenticate your GitHub\naccount(s)](https://cli.github.com/manual/gh_auth_login) with the GH CLI.\n\n### Setup shell to use Gamon3\n\n#### Bash\n\nAdd the following to `~/.bashrc`:\n\n```bash\neval \"$(gamon3 hook bash)\"\n```\n\n#### Zsh\n\nAdd the following to `~/.zshrc`:\n\n```bash\neval \"$(gamon3 hook zsh)\"\n```\n\n#### Fish\n\nAdd the following to `~/.config/fish/config.fish`:\n\n```fish\ngamon3 hook fish | source\n```\n\n#### Other Shells\n\nIf you use another shell, consult its documentation to see how to hook into the\n`cd` command or 'change `PWD`' event. I probably won't spend any time researching\nmore niche shells that I don't personally use, but feel free to open a pull\nrequest to add support for your favourite shell.\n\n### Configure Gamon3\n\nAs a minimum, create a config file:\n\n```bash\nmkdir -p \"$HOME/.config/gamon3\" \u0026\u0026 touch \"$HOME/.config/gamon3/config.yaml\"\n```\n\nThen put this inside:\n\n```yaml\n---\ndefault: \u003cyour-primary-github-account\u003e\n```\n\nFor more detail, see [Configuration](#configuration).\n\n## Configuration\n\n### Config File Location\n\nGamon3 will check 3 locations for a config file:\n\n1. `$GAMON3_CONFIG_DIR/config.yaml`\n1. `$XDG_CONFIG_HOME/gamon3/config.yaml`\n1. `$HOME/.config/gamon3/config.yaml`\n\nUsing `config.yml` is also supported.\n\n### Config File Structure\n\n| Field      | Required | Type                   | Description                                                            |\n| ---------- | -------- | ---------------------- | ---------------------------------------------------------------------- |\n| `default`  | yes      | `string`               | Primary GitHub account for the user                                    |\n| `accounts` | no       | `string` -\u003e `string[]` | Mapping of GitHub accounts to directories in which they should be used |\n\nE.g.\n\n```yaml\n---\ndefault: primary-account\naccounts:\n  work-account:\n    - $HOME/repos/work\n    - ~/work/github/\n    - $WORK\n  some-other-account:\n    - $HOME/other-stuff/\n```\n\nThis config file is especially useful if projects are organised by GitHub\naccount.\n\n\u003e [!NOTE]\n\u003e\n\u003e You do not need to specify the `default` account in `accounts`, as it will\n\u003e always be a fallback option.\n\n### Overrides\n\nThe default configuration file can be overridden in two ways:\n\n- a local `.gamon.yaml` or `.gamon3.yaml` config file (`.yaml` or `.yml`), or\n- the `GAMON3_ACCOUNT` environment variable.\n\nThese overrides are useful if projects are not always organised by GitHub\naccount.\n\n#### Local Config File\n\nGamon3 will search (inclusively) upward from `$PWD` to `$HOME` for a file\ncalled `.gamon.yaml` or `.gamon3.yaml`. This file should contain a single\n`account` key with a `value` being the GitHub account to use. If `$PWD` is\nnot a descendant of `$HOME`, the search will continue until the filesystem\nroot (on Linux and MacOS this is `/`).\n\nE.g.\n\n```yaml\n---\naccount: some-account\n```\n\n#### Environment Variable\n\nGamon3 will check to see if the `GAMON3_ACCOUNT` environment variable has been\nset to a valid GitHub account. If it has, this will override both a local\n`.gamon3.yaml` and the main `config.yaml`.\n\n### Account Resolution and Errors\n\nCurrently, Gamon3 will only report configuration errors if they affect the\naccount you are trying to switch to. For example, if you have a completely\ninvalid local config file, but the account is selected via an envionrment\nvariable, the local config file will never be checked and thus no erros will be\nfound.\n\n\u003e [!NOTE]\n\u003e\n\u003e I plan to eventually add a `gamon3 doctor` command that will check all\n\u003e discovered config files and report all problems. See [this\n\u003e issue](https://github.com/peter-bread/gamon3/issues/22).\n\n## See Also\n\n- [Homebrew Tap](https://github.com/peter-bread/homebrew-tap)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeter-bread%2Fgamon3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeter-bread%2Fgamon3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeter-bread%2Fgamon3/lists"}