@oh-gc/cli
v0.7.4
Published
GitCode CLI — manage issues and PRs from the terminal
Maintainers
Readme
oh-gc — GitCode CLI
A command-line interface for GitCode, modeled after GitHub CLI (gh). Manage issues, pull requests, and authentication without leaving the terminal.
oh-gc issue list
oh-gc issue view 12
oh-gc pr create --title "Fix login bug" --base main
oh-gc pr merge 5 --method squashInstallation
npm (Recommended)
npm install -g @oh-gc/cli
oh-gc --helpFrom Source
git clone https://gitcode.com/guozejun/ohos_gitcode_cli.git
cd ohos_gitcode_cli
npm install
npm run build
npm linkAI Skill
oh-gc ships with a skill file that teaches AI assistants (Claude Code, OpenCode) how to use the CLI.
Claude Code
Two commands to install:
/plugin marketplace add https://gitcode.com/guozejun/ohos_gitcode_cli.git
/plugin install gitcode-cli@oh-gcTo update to the latest version:
/plugin marketplace update oh-gcOpenCode
Tell OpenCode:
Fetch and follow instructions from https://raw.gitcode.com/guozejun/ohos_gitcode_cli/raw/master/skills/gitcode-cli/INSTALL.mdQuick Start
1. Log in with your GitCode personal access token:
oh-gc auth login
# Enter your GitCode personal access token: ••••••••••
# Logged in as yourname (Your Name)Get a token at: GitCode → Settings → Access Tokens
2. Navigate to a GitCode repository:
cd your-project # must be a git repo with a gitcode.com remote
oh-gc issue listIf your remote is not named origin, configure it:
oh-gc repo set-remote upstreamCommand Index
Authentication
| Command | Description | Docs |
|---------|-------------|------|
| oh-gc auth login | Log in with a personal access token | → Details |
| oh-gc auth logout | Remove stored token | → Details |
| oh-gc auth status | Show currently logged-in user | → Details |
Issues
| Command | Description | Docs |
|---------|-------------|------|
| oh-gc issue list | List issues | → Details |
| oh-gc issue view | View issue details | → Details |
| oh-gc issue create | Create an issue | → Details |
| oh-gc issue update | Update an issue | → Details |
| oh-gc issue close | Close an issue | → Details |
| oh-gc issue reopen | Reopen a closed issue | → Details |
| oh-gc issue comment | Add a comment | → Details |
| oh-gc issue history | View modification history | → Details |
| oh-gc issue labels | Add or remove labels | → Details |
| oh-gc issue reactions | List reactions | → Details |
| oh-gc issue prs | List linked pull requests | → Details |
| oh-gc issue branches | List or set related branches | → Details |
| oh-gc issue comment-get | Get a comment | → Details |
| oh-gc issue comment-edit | Edit a comment | → Details |
| oh-gc issue comment-delete | Delete a comment | → Details |
| oh-gc issue comment-history | View comment history | → Details |
| oh-gc issue comment-reactions | View comment reactions | → Details |
Pull Requests
| Command | Description | Docs |
|---------|-------------|------|
| oh-gc pr list | List pull requests | → Details |
| oh-gc pr view | View PR details | → Details |
| oh-gc pr create | Create a pull request | → Details |
| oh-gc pr update | Update a pull request | → Details |
| oh-gc pr close | Close a pull request | → Details |
| oh-gc pr reopen | Reopen a closed PR | → Details |
| oh-gc pr merge | Merge a pull request | → Details |
| oh-gc pr diff | View PR changes | → Details |
| oh-gc pr comment | Add a comment | → Details |
| oh-gc pr comments | List or delete comments | → Details |
| oh-gc pr commits | List commits in a PR | → Details |
| oh-gc pr logs | View operation logs | → Details |
| oh-gc pr reactions | List reactions | → Details |
| oh-gc pr reviewers | Manage reviewers | → Details |
| oh-gc pr testers | Manage testers | → Details |
| oh-gc pr review | Approve a PR review | → Details |
| oh-gc pr test | Mark test as passed | → Details |
| oh-gc pr labels | Add or remove labels | → Details |
| oh-gc pr link | Link or unlink issues | → Details |
| oh-gc pr files | List changed files | → Details |
| oh-gc pr history | View modification history | → Details |
| oh-gc pr linked-issues | List linked issues | → Details |
| oh-gc pr assignees | Manage assignees | → Details |
| oh-gc pr settings | View PR settings | → Details |
| oh-gc pr settings-update | Update PR settings | → Details |
| oh-gc pr option-reviewers | List eligible reviewers | → Details |
| oh-gc pr comment-get | Get a PR comment | → Details |
| oh-gc pr comment-edit | Edit a PR comment | → Details |
| oh-gc pr comment-delete | Delete a PR comment | → Details |
| oh-gc pr comment-history | View comment history | → Details |
| oh-gc pr comment-reactions | View comment reactions | → Details |
Repository
| Command | Description | Docs |
|---------|-------------|------|
| oh-gc repo list | List repositories | → Details |
| oh-gc repo create | Create a new repository | → Details |
| oh-gc repo delete | Delete a repository | → Details |
| oh-gc repo fork | Fork a repository | → Details |
| oh-gc repo forks | List repository forks | → Details |
| oh-gc repo settings | View or update repo settings | → Details |
| oh-gc repo languages | Show languages used in a repo | → Details |
| oh-gc repo contributors | List contributors | → Details |
| oh-gc repo events | List repository events | → Details |
| oh-gc repo stats | Show commit/download statistics | → Details |
| oh-gc repo archive | Archive or unarchive a repository | → Details |
| oh-gc repo transition | View or update permission mode | → Details |
| oh-gc repo module | Enable or disable repo modules | → Details |
| oh-gc repo roles | List customized roles | → Details |
| oh-gc repo view | View repository info | → Details |
| oh-gc repo update | Update repository settings | → Details |
| oh-gc repo transfer | Transfer repository ownership | → Details |
| oh-gc repo set-remote | Set which remote oh-gc uses | → Details |
| oh-gc repo get-remote | Show current remote | → Details |
Branches
| Command | Description | Docs |
|---------|-------------|------|
| oh-gc branch list | List branches | → Details |
| oh-gc branch get | View branch details | → Details |
| oh-gc branch create | Create a branch | → Details |
| oh-gc branch delete | Delete a branch | → Details |
| oh-gc branch protect | Set branch protection | → Details |
| oh-gc branch protect-rules | List protection rules | → Details |
| oh-gc branch protect-rule-create | Create protection rule | → Details |
| oh-gc branch protect-rule-update | Update protection rule | → Details |
| oh-gc branch protect-rule-delete | Delete protection rule | → Details |
Commits
| Command | Description | Docs |
|---------|-------------|------|
| oh-gc commit list | List commits | → Details |
| oh-gc commit get | View commit details | → Details |
| oh-gc commit diff | View commit diff | → Details |
| oh-gc commit compare | Compare two refs | → Details |
| oh-gc commit comments | List commit comments | → Details |
| oh-gc commit comment | Create a commit comment | → Details |
Files
| Command | Description | Docs |
|---------|-------------|------|
| oh-gc file get | Get file contents (base64) | → Details |
| oh-gc file raw | Get raw file contents | → Details |
| oh-gc file list | List directory contents | → Details |
| oh-gc file create | Create a file | → Details |
| oh-gc file update | Update a file | → Details |
| oh-gc file delete | Delete a file | → Details |
Labels
| Command | Description | Docs |
|---------|-------------|------|
| oh-gc label list | List repository labels | → Details |
| oh-gc label create | Create a label | → Details |
| oh-gc label update | Update a label | → Details |
| oh-gc label delete | Delete a label | → Details |
Milestones
| Command | Description | Docs |
|---------|-------------|------|
| oh-gc milestone list | List milestones | → Details |
| oh-gc milestone get | View milestone details | → Details |
| oh-gc milestone create | Create a milestone | → Details |
| oh-gc milestone update | Update a milestone | → Details |
| oh-gc milestone delete | Delete a milestone | → Details |
Collaborators
| Command | Description | Docs |
|---------|-------------|------|
| oh-gc collaborator list | List collaborators | → Details |
| oh-gc collaborator add | Add a collaborator | → Details |
| oh-gc collaborator remove | Remove a collaborator | → Details |
| oh-gc collaborator permission | Get permission level | → Details |
Webhooks
| Command | Description | Docs |
|---------|-------------|------|
| oh-gc hook list | List webhooks | → Details |
| oh-gc hook get | View webhook details | → Details |
| oh-gc hook create | Create a webhook | → Details |
| oh-gc hook delete | Delete a webhook | → Details |
Tags
| Command | Description | Docs |
|---------|-------------|------|
| oh-gc tag list | List repository tags | → Details |
| oh-gc tag create | Create a tag | → Details |
| oh-gc tag delete | Delete a tag | → Details |
| oh-gc tag protect | Protect or unprotect a tag | → Details |
| oh-gc tag protect-get | Get protected tag details | → Details |
| oh-gc tag protect-create | Create protected tag rule | → Details |
| oh-gc tag protect-update | Update protected tag rule | → Details |
| oh-gc tag protect-delete | Delete protected tag rule | → Details |
Release
| Command | Description | Docs |
|---------|-------------|------|
| oh-gc release create | Create a release | → Details |
Organizations
| Command | Description | Docs |
|---------|-------------|------|
| oh-gc org list | List your organizations | → Details |
| oh-gc org view | View organization details | → Details |
| oh-gc org members | List organization members | → Details |
User
| Command | Description | Docs |
|---------|-------------|------|
| oh-gc user view | View user profile | → Details |
| oh-gc user edit | Update your profile | → Details |
| oh-gc user emails | List your email addresses | → Details |
| oh-gc user followers | List user followers | → Details |
| oh-gc user following | List followed users | → Details |
| oh-gc user events | List user activity events | → Details |
| oh-gc user search | Search users | → Details |
| oh-gc user namespace | Get namespace by path | → Details |
| oh-gc user namespaces | List all namespaces | → Details |
| oh-gc user keys | List SSH keys | → Details |
| oh-gc user key-add | Add an SSH key | → Details |
| oh-gc user key-delete | Delete an SSH key | → Details |
| oh-gc user starred | List starred repositories | → Details |
| oh-gc user subscriptions | List watched repositories | → Details |
| oh-gc user issues | List your issues (all repos) | → Details |
| oh-gc user prs | List your PRs (all repos) | → Details |
| oh-gc user orgs | List user's organizations | → Details |
| oh-gc user membership | View org membership | → Details |
| oh-gc user leave-org | Leave an organization | → Details |
Search
| Command | Description | Docs |
|---------|-------------|------|
| oh-gc search repos | Search repositories | → Details |
| oh-gc search issues | Search issues and PRs | → Details |
| oh-gc search code | Search code | → Details |
Repository Flag
Most commands that operate on a repository support the --repo flag, which allows you to specify a target repository without being inside a git clone:
| Flag | Description |
|------|-------------|
| --repo owner/repo | Target repository in OWNER/REPO format |
Examples:
oh-gc issue list --repo openharmony/arkui_ace_engine
oh-gc issue create --repo owner/repo --title "Bug report"
oh-gc pr view 123 --repo owner/repoGlobal Flags
All commands support:
| Flag | Description |
|------|-------------|
| --json | Output raw JSON instead of formatted table |
| --help | Show command help |
Configuration
Token
Stored at ~/.config/gitcode-cli/config.json. Set via oh-gc auth login, removed via oh-gc auth logout.
Remote
By default oh-gc uses the origin remote. To use a different remote for run oh-gc repo set-remote <name>. This writes a .gitcode/oh-gc-config.json file in the repo root:
{ "remote": "upstream" }You can commit or gitignore the .gitcode/ directory — oh-gc never modifies .gitignore.
Proxy
oh-gc automatically picks up the standard https_proxy / HTTPS_PROXY environment variables. No extra configuration needed.
Exit Codes
0— success1— error (authentication failure, network error, invalid input, etc.)
License
MIT
