https://github.com/canoypa/gh-cgu
Change / Current Git User
https://github.com/canoypa/gh-cgu
gh-extension git
Last synced: about 1 month ago
JSON representation
Change / Current Git User
- Host: GitHub
- URL: https://github.com/canoypa/gh-cgu
- Owner: canoypa
- Created: 2022-01-08T02:43:26.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-05-10T15:07:58.000Z (about 2 years ago)
- Last Synced: 2025-03-05T13:46:09.103Z (over 1 year ago)
- Topics: gh-extension, git
- Language: Go
- Homepage:
- Size: 3.98 MB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gh-cgu
Manage and switch git user profiles as a [GitHub CLI](https://cli.github.com/) extension.
## Installation
```shell
gh extension install canoypa/gh-cgu
```
## Usage
```shell
# Show current git user
gh cgu
# Switch to a saved profile
gh cgu use
# Add a new profile
gh cgu add
gh cgu add --key # override the auto-derived key
# Edit an existing profile
gh cgu edit --name
gh cgu edit --email
gh cgu edit --key
# Remove a profile
gh cgu remove
# List all profiles
gh cgu list
```
## Profiles
Profiles are stored in `~/.config/gh-cgu/config.yml` and automatically synced to a private Gist (`gh-cgu-{login}-config.yml`).
On first run with no local config, profiles are restored from the Gist automatically.
Profile keys are derived from `` by replacing spaces, underscores, and dots with hyphens (e.g. `Work User` → `work-user`, `user.name` → `user-name`). Unicode letters, digits, hyphens, and underscores are allowed; YAML-special characters (`. : # @` etc.) and whitespace are rejected. Use `--key` to override the auto-derived key.
- `gh cgu use` works in normal clones, git worktrees, and submodules.
- `gh cgu edit --key ` fails if `` already exists.