{"id":13702525,"url":"https://github.com/gabe565/gh-profile","last_synced_at":"2025-05-05T04:31:05.979Z","repository":{"id":61311325,"uuid":"550438540","full_name":"gabe565/gh-profile","owner":"gabe565","description":":octocat: Use multiple GitHub accounts with the gh cli.","archived":true,"fork":false,"pushed_at":"2024-01-15T21:39:55.000Z","size":1205,"stargazers_count":148,"open_issues_count":2,"forks_count":10,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-13T09:41:01.983Z","etag":null,"topics":["gh-extension","github-cli"],"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/gabe565.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-12T19:12:21.000Z","updated_at":"2024-11-02T08:22:44.000Z","dependencies_parsed_at":"2023-02-19T15:15:29.765Z","dependency_job_id":"66377cc9-e957-4bdd-8951-c2ad1c028aef","html_url":"https://github.com/gabe565/gh-profile","commit_stats":{"total_commits":97,"total_committers":3,"mean_commits":"32.333333333333336","dds":0.09278350515463918,"last_synced_commit":"6b365fc27321118a510279895fe6933294b2546a"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabe565%2Fgh-profile","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabe565%2Fgh-profile/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabe565%2Fgh-profile/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabe565%2Fgh-profile/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gabe565","download_url":"https://codeload.github.com/gabe565/gh-profile/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252439533,"owners_count":21748025,"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","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":["gh-extension","github-cli"],"created_at":"2024-08-02T21:00:37.192Z","updated_at":"2025-05-05T04:31:05.605Z","avatar_url":"https://github.com/gabe565.png","language":"Go","funding_links":[],"categories":["gh-extension","Github","Go"],"sub_categories":[],"readme":"# gh-profile\n\n[![Build](https://github.com/gabe565/gh-profile/actions/workflows/build.yml/badge.svg)](https://github.com/gabe565/gh-profile/actions/workflows/build.yml)\n[![Go Report Card](https://goreportcard.com/badge/github.com/gabe565/gh-profile?v=1)](https://goreportcard.com/report/github.com/gabe565/gh-profile)\n\nWork with multiple GitHub accounts using the [gh cli](https://cli.github.com/).\n\n\u003e [!IMPORTANT]\n\u003e Official multi-account support was added to the `gh` cli in [v2.40.0](https://github.com/cli/cli/releases/tag/v2.40.0). This repository will no longer be maintained, and it is suggested to use the official multi-account implementation. See GitHub's multi-account docs [here](https://github.com/cli/cli/blob/trunk/docs/multiple-accounts.md).\n\n\u003cimg alt=\"gh-profile demo\" src=\"../demo/demo.gif\" width=\"640\"\u003e\n\n## Installation\n\n```shell\ngh extension install gabe565/gh-profile\n```\n\n## Usage\n\nSee the [generated usage docs](./docs/gh-profile.md), or see a summary of each\nsubcommand below.\n\n\u003e **Note**\n\u003e As of v2.26.0, the gh cli now uses secure auth tokens by default.\n\u003e Secure auth tokens are not yet supported by gh-profile, so when logging into GitHub, make sure to run:  \n\u003e `gh auth login --insecure-storage`\n\n- **`gh profile create [NAME]`:** Creates a new profile.\n  \u003cdetails\u003e\n    \u003csummary\u003eDetails\u003c/summary\u003e\n\n  **Aliases:** `c`, `new`, `add`\n\n  **Params:**\n  - `NAME` is optional. If not set, command will run interactively.\n\n  **Example:**\n  ```shell\n  $ gh profile create example\n  ✨ Creating profile: example\n  🔧 Activating global profile: example\n  ```\n  \u003c/details\u003e\n- **`gh profile switch [NAME] [--local-dir]`:** Activates a profile.\n  \u003cdetails\u003e\n    \u003csummary\u003eDetails\u003c/summary\u003e\n\n  **Aliases:** `activate`, `active`, `sw`, `s`\n\n  **Params:**\n  - `NAME` is optional. If not set, command will run interactively.\n    - If set to `-`, gh-profile will switch back to the previous profile.\n  - `--local-dir`/`-l` activates the profile only for the current directory.\n    - For this to work, you must install a per-directory env tool like [direnv](https://direnv.net).\n\n  **Example:**\n  ```shell\n  $ gh profile switch example\n  🔧 Activating global profile: example\n  ```\n  \u003c/details\u003e\n- **`gh profile rename [NAME] [NEW_NAME]`:** Renames a profile.\n  \u003cdetails\u003e\n    \u003csummary\u003eDetails\u003c/summary\u003e\n\n  **Aliases:** `mv`\n\n  **Params:**\n  - `NAME` and `NEW_NAME` are optional. If not set, command will run interactively.\n\n  **Example:**\n  ```shell\n  $ gh profile rename example example2\n  🚚 Renaming profile: example to example2\n  🔧 Activating global profile: example2\n  ```\n  \u003c/details\u003e\n- **`gh profile list`:** Lists all profiles. Active profile will be bold with a green check.\n  \u003cdetails\u003e\n    \u003csummary\u003eDetails\u003c/summary\u003e\n\n  **Aliases:** `ls`, `l`\n\n  **Example:**\n  ```shell\n  $ gh profile list\n  ✓ example\n    gabe565\n  ```\n  \u003c/details\u003e\n- **`gh profile remove [NAME]`:** Removes a profile.\n  \u003cdetails\u003e\n    \u003csummary\u003eDetails\u003c/summary\u003e\n\n  **Aliases:** `delete`, `rm`, `d`\n\n  **Params:**\n  - `NAME` is optional. If not set, command will run interactively.\n\n  **Example:**\n  ```shell\n  $ gh profile remove example2\n  🔥 Removing profile: example2\n  ```\n  \u003c/details\u003e\n\n- **`gh profile show`:** Prints the active profile name. If no profile is active, nothing will be printed. Useful as a [prompt element](#prompt-element).\n  \u003cdetails\u003e\n    \u003csummary\u003eDetails\u003c/summary\u003e\n\n  **Example**:\n  ```shell\n  $ gh profile show\n  example\n  ```\n  \u003c/details\u003e\n\n## Prompt Element\n\n`gh profile show` is useful for displaying the current profile in your\nshell's prompt. This command will work for any prompt, but configuration\nwith [Powerlevel10k](https://github.com/romkatv/powerlevel10k) is provided\nbelow.\n\n### Powerlevel10k\n\nPowerlevel10k ships with a custom formatter for `git` repositories. This\nformatter can be easily modified to show the current profile.\n\n1. Edit `~/.p10k.zsh`.\n2. Find the `my_git_formatter` function\n3. Find the line `local res`\n4. Add the following below that line:\n    ```shell\n        local profile=\"$(gh profile show 2\u003e/dev/null)\"\n        [[ -n \"$profile\" ]] \u0026\u0026 res+=\"$profile \"\n    ```\n\nNow, the current profile will be shown when you are in a git repo!\n\n#### Example\n\n| Before | After |\n|--------|-------|\n| \u003cimg width=\"280\" alt=\"Before\" src=\"https://user-images.githubusercontent.com/114527278/199317857-876031b4-ac6f-45e5-84c5-304eadcbf5e6.png\"\u003e | \u003cimg width=\"345\" alt=\"After\" src=\"https://user-images.githubusercontent.com/114527278/199317888-7901518a-2a9c-40f8-8416-5c95cb62d60a.png\"\u003e |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgabe565%2Fgh-profile","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgabe565%2Fgh-profile","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgabe565%2Fgh-profile/lists"}