An open API service indexing awesome lists of open source software.

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

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.