gitee-cli-rs 0.1.4

A gh-like command-line client for Gitee
Documentation

gitee

A gh-like command-line client for Gitee. Manage pull requests, issues, releases, gists, and more from your terminal.

Quick start

1 — Install (pick one):

cargo install gitee-cli-rs      # build from crates.io
cargo binstall gitee-cli-rs     # pre-built binary (no compile)
brew install kipyin/tap/gitee   # macOS via Homebrew

Or grab a binary from GitHub Releases.

2 — Log in with a Gitee personal access token:

gitee auth login

3 — Use it. Run inside any git clone (or add --repo owner/name):

gitee pr list        # pull requests
gitee issue list     # issues
gitee status         # your open issues across repos
gitee release list   # releases
gitee repo view      # repo info

That's it. Everything below is detail.

Install

Method Command Notes
crates.io cargo install gitee-cli-rs builds from source
cargo-binstall cargo binstall gitee-cli-rs same binary, no compile
Homebrew (macOS) brew install kipyin/tap/gitee arm64 + x86_64
Direct download Releases gitee-<target>-v<ver>.tar.xz
From source cargo install --path . after git clone

The crates.io package is gitee-cli-rs, but the installed command is gitee.

Shell completions (bash/zsh/fish/powershell/elvish):

gitee completions zsh > "${fpath[1]}/_gitee"

Configure

The CLI needs a Gitee personal access token. Create one at https://gitee.com/profile/personal_access_tokens (default scopes are fine for reading; check pull_requests, issues, and projects for write actions).

gitee auth login                  # prompts for the token, validates it, stores it

For CI / scripts, use an environment variable instead:

export GITEE_TOKEN=your_token

Token lookup order: $GITEE_TOKEN → OS keyring → ~/.config/gitee/<host>/… (per-user token files after login; legacy ~/.config/gitee/<host>.token is migrated).

Useful commands:

gitee auth status                 # where am I logged in / who's active?
gitee auth token                  # print the active token (for piping)
gitee auth switch --user alice    # pick among saved accounts on this host
gitee auth setup-git              # use gitee as git credential helper
gitee auth logout                 # forget the stored token
gitee config set editor nvim      # defaults: host / remote / editor
gitee alias set co pr checkout    # expand `gitee co 42` → `gitee pr checkout 42`

Everyday commands

Run from inside a repo, or point anywhere with --repo owner/name.

# pull requests
gitee pr list
gitee pr status                      # created / assigned / awaiting my test
gitee pr view 42
gitee pr view 42 --web               # open in browser
gitee pr diff 42
gitee pr checkout 42                 # fetch into local branch pr-42
gitee pr create --title "Fix" --head my-branch
gitee pr create                      # interactive title/body on a TTY
gitee pr create --fill               # title/body from commits
gitee pr edit 42 --title "Retitle" --label bug
gitee pr comment 42 -m "LGTM"
gitee pr approve 42                  # 审查通过
gitee pr test 42                     # 测试通过 (Gitee-specific)
gitee pr merge 42 --squash

# issues
gitee issue list
gitee issue status                   # created / assigned to me
gitee issue view I88
gitee issue view I88 --web
gitee issue create --title "Bug" --body "steps…"
gitee issue create                   # interactive title/body on a TTY
gitee issue edit I88 --label bug --milestone v1.0
gitee issue edit I88 --state progressing   # open|progressing|closed|rejected
gitee issue comment I88 -m "looking into it"
gitee issue close I88

# cross-repo dashboard / browser
gitee status                         # assigned / created open issues
gitee browse                         # open the resolved repo in a browser

# search
gitee search repos gitee --language Rust
gitee search issues login --state open
gitee search users kip

# releases
gitee release list
gitee release view v1.0.0
gitee release view v1.0.0 --web
gitee release create --tag v1.0.0 --notes "changelog…"
gitee release upload v1.0.0 dist/*.tar.xz
gitee release download v1.0.0 --dir ./dist
gitee release edit v1.0.0 --notes "updated notes"

# repositories
gitee repo view oschina/git
gitee repo view --web
gitee repo list
gitee repo clone oschina/git
gitee repo fork
gitee repo create my-tool --private
gitee repo edit --description ""
gitee repo rename new-slug
gitee repo star                      # also: unstar / watch / unwatch

# labels / milestones
gitee label list
gitee label create bug --color ff0000
gitee milestone list
gitee milestone create --title v1.0 --due-on 2026-12-31

# org / access / hooks
gitee org list
gitee ssh-key list
gitee ssh-key add ~/.ssh/id_ed25519.pub --title laptop
gitee collaborator list
gitee collaborator add alice --permission push
gitee webhook list
gitee webhook create --url https://example.com/hook --events push_events

# gists
gitee gist list
gitee gist create notes.md --desc "scratch"
gitee gist view <id> --raw

# config / aliases / extensions
gitee config list
gitee alias list
gitee extension list                 # gitee-* binaries on PATH
# unknown commands also exec `gitee-<name>` from PATH (gh-style)

# raw API escape hatch
gitee api user
gitee api repos/oschina/git/releases --paginate

Handy global flags:

gitee pr list --json number,title          # JSON field projection
gitee pr list --json --jq '.[].title'      # jq after projection
gitee --debug pr list                      # HTTP trace on stderr
gitee --repo owner/name pr list            # target a repo without cd'ing
gitee --remote gitee pr status             # resolve via a non-origin remote
gitee --host git.example.com ...           # self-hosted Gitee

Command reference

Subcommand Description
list List PRs (--state, --author, --limit)
status Open PRs relevant to you: created, assigned, awaiting your test (--limit)
view <n> Show pull request details (--web opens in browser)
diff <n> Show pull request diff
checkout <n> Fetch and check out a pull request locally
create Open a PR (--title / --fill, or interactive on a TTY; --body, --head, --base, --assignee, --tester, --label, --milestone, --close-issue)
edit <n> Edit metadata (--title, --body, --assignee, --tester, --label, --milestone)
merge <n> Merge (--squash, --rebase, --no-close-issue)
comment <n> Add a comment (-m/--body)
approve <n> Approve / 审查通过 (--force)
test <n> Mark tested / 测试通过 (--force) — Gitee-specific
close <n> / reopen <n> Change state
link <n> <issue> Link a pull request to an issue
Subcommand Description
list List issues (--state, --assignee, --limit)
status Open issues relevant to you: created, assigned (--limit)
view <n> Show issue details (--web; Gitee issue idents are strings, e.g. I88)
create Create (--title or interactive on a TTY; --body, --assignee, --labels, --milestone, --security-hole)
edit <n> Edit metadata (--title, --body, --assignee, --label, --milestone, --security-hole, --state)
close <n> / reopen <n> Change state (open/closed shortcuts; prefer edit --state for progressing/rejected)
link <n> <pr> Link an issue to a pull request
comment <n> Add a comment (-m/--body)
Flag Description
--limit Cap each section (default 30)

Shows open issues assigned to you and created by you across all repos. PR sections are omitted — Gitee v5 has no user-level pulls endpoint.

Subcommand Description
repos <query> Search repositories (--owner, --language, --fork, --sort, --order, --limit)
issues <query> Search issues (--state, --author, --assignee, --label, --language, --sort, --order, --limit; scoped with global --repo)
users <query> Search users (--sort, --order, --limit)
Subcommand Description
list List releases (--limit)
view <tag> Show release details (--web opens in browser)
create Create (--tag required; --name, --notes, --target, --prerelease)
upload <tag> <files…> Attach files to an existing release
download <tag> Download assets (--dir, --pattern)
edit <tag> Edit (--name, --notes, --prerelease)
delete <tag> Delete (--yes to skip confirmation)
Subcommand Description
view [repo] Show repository details (--web opens in browser)
list [owner] List repos (yours, or a user/org's public repos) (--limit)
clone <spec> [dir] Clone via git (--ssh)
fork Fork the resolved repository (--add-remote <name>)
create <name> Create under your account or --org (--private, --description, --homepage, --gitignore, --license)
edit Edit settings (--description, --homepage, --private/--public, --default-branch)
rename <path> Rename the URL slug
star / unstar Star or unstar the resolved repository
watch / unwatch Watch or unwatch the resolved repository
delete Delete (--yes to skip confirmation)
Subcommand Description
list List labels (--limit)
create <name> Create (--color required, hex without #)
edit <name> Edit (--name, --color)
delete <name> Delete (--yes to skip confirmation)
Subcommand Description
list List milestones (--state, --limit)
view <n> Show milestone details
create Create (--title and --due-on YYYY-MM-DD required; --description, --state)
edit <n> Edit (--title, --due-on, --description, --state)
Subcommand Description
list List your gists (--limit)
view <id> Show a gist (--raw prints file contents)
create <files…> Create (--desc, --public, --filename when reading - from stdin)
edit <id> <file> Replace one file's contents
delete <id> Delete (--yes to skip confirmation)

Like gh api. Pass an endpoint path, optional -X method, -F/-f fields, -H headers, --input, and --paginate for array paging.

gitee api user
gitee api /repos/oschina/git/issues -X POST -F title=Bug -F body=steps
gitee api repos/oschina/git/releases --paginate

Issue state changes are a common footgun: use PATCH /repos/{owner}/issues/{number} with a JSON body {"repo":"<name>","title":"<current title>","state":"progressing"} (title must be echoed or Gitee blanks it). The /repos/{owner}/{repo}/issues/{number} path with form -f state=… often returns 404 {"message":"project or enterprise"}. Prefer gitee issue edit <n> --state … when you can.

Subcommand Description
login Store a token (--token, --force to skip validation)
status Show login status, active user, and token source
token Print the active token
logout Forget the stored token for the current host
switch --user <name> Switch the active saved account for this host
setup-git Configure git to use gitee as credential helper for this host
git-credential Git credential-helper protocol (get / store / erase; usually invoked by git)

Opens the resolved repository in your default browser. Prefer view --web when you already know the PR / issue / release / repo target.

Subcommand Description
list List organizations for the authenticated user (--limit)
Subcommand Description
list List your SSH public keys (--limit)
add <pubkey-file> Upload a public key (--title)
delete <id> Delete a key (--yes to skip confirmation)
Subcommand Description
list List collaborators on the resolved repo (--limit)
add <username> Add a collaborator (--permission pull|push|admin, default push)
remove <username> Remove a collaborator (--yes to skip confirmation)
Subcommand Description
list List webhooks (--limit)
create Create (--url required; --events push_events/tag_push_events/issues_events/merge_requests_events/note_events; --password)
delete <id> Delete (--yes to skip confirmation)
Subcommand Description
list Show configured keys
get <key> Read one key (host, remote, editor)
set <key> <value> Write one key

Stored in ~/.config/gitee/config.json. CLI flags still win over these defaults.

Subcommand Description
list Show aliases
set <name> <expansion…> Define an alias (shell-quote multi-word expansions)
delete <name> Remove an alias

Example: gitee alias set co pr checkoutgitee co 42 expands to gitee pr checkout 42.

Subcommand Description
list List gitee-* executables discovered on PATH

Unknown top-level commands also exec gitee-<name> from PATH (same model as gh).

Global flags

Flag Description
--repo <owner/name> Target repository (default: resolved from git remote)
--remote <name> Git remote to resolve the repo from (default: origin)
--host <host> Gitee host (default: gitee.com)
--json [fields] JSON output; --json number,title projects fields
--jq <expr> jq expression on --json output (requires --json)
--debug Log HTTP requests/responses to stderr

Repository resolution

Most commands operate on a repository resolved two ways:

  1. --repo owner/name, or
  2. from the current directory's git remote (--remote, default origin).

So either cd into a clone, or pass --repo / --remote explicitly.

Compared to gh (与 gh 的差异)

Gitee OpenAPI v5 does not expose everything GitHub CLI can reach. These are not planned (no public API / no Gitee equivalent):

  • gh workflow / gh run / gh pr checks / secrets / variables — Gitee Go has no public v5 REST API; PR 门禁 is only available via third-party apps
  • issue transfer / pin / lock / delete — no Gitee API
  • repo archive — no Gitee API
  • codespaces / projects / attestations / discussions — no Gitee equivalent

Also omitted after swagger verification: repo sync, pr update-branch.

Gitee-specific (Gitee 特色)

Features beyond GitHub CLI parity:

Feature Status Notes
pr test shipped 测试通过 gate; pairs with pr approve (审查通过)
issue --security-hole shipped mark an issue as a security hole on create/edit
milestone shipped full list/view/create/edit; Gitee requires --due-on on create
pr assignees and testers shipped dual review/test roles on create/edit/status
repo star / watch shipped star / unstar / watch / unwatch
webhook shipped list / create / delete repository hooks

License

MIT — see Cargo.toml.