Linux command
gh 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Clone a repository
gh repo clone [owner]/[repo]
Create a pull request
gh pr create --title "[title]" --body "[description]"
List open issues
gh issue list
View pull request status
gh pr status
Create a new repo
gh repo create [name] --public
View and check out a pull request
gh pr checkout [pr_number]
View workflow run status
gh run list
Open repo in browser
gh browse
说明
gh is GitHub's official command line tool. It brings GitHub features to the terminal, allowing you to manage repositories, issues, pull requests, and more without leaving your development environment. The tool integrates deeply with git workflows, enabling seamless transitions between local development and GitHub collaboration. It supports interactive prompts for complex operations and scripted automation for CI/CD pipelines. gh provides a unified interface for GitHub's REST and GraphQL APIs with built-in authentication and configuration management.
参数
- repo
- Manage repositories.
- pr
- Manage pull requests.
- issue
- Manage issues.
- auth
- Authenticate with GitHub.
- browse
- Open repository in browser.
- gist
- Manage gists.
- workflow
- Manage GitHub Actions workflows.
- run
- View and manage workflow runs.
- release
- Manage releases.
- codespace
- Manage GitHub Codespaces.
- search
- Search repositories, issues, and pull requests across GitHub.
- project
- Manage GitHub Projects.
- cache
- Manage GitHub Actions caches.
- secret
- Manage secrets for GitHub Actions.
- variable
- Manage GitHub Actions variables.
- label
- Manage issue and PR labels.
- extension
- Manage gh CLI extensions.
- api
- Make authenticated GitHub API requests.
- status
- Display status of relevant issues, pull requests, and notifications.
- --help
- Display help information.
- --version
- Display version information.
FAQ
What is the gh command used for?
gh is GitHub's official command line tool. It brings GitHub features to the terminal, allowing you to manage repositories, issues, pull requests, and more without leaving your development environment. The tool integrates deeply with git workflows, enabling seamless transitions between local development and GitHub collaboration. It supports interactive prompts for complex operations and scripted automation for CI/CD pipelines. gh provides a unified interface for GitHub's REST and GraphQL APIs with built-in authentication and configuration management.
How do I run a basic gh example?
Run `gh repo clone [owner]/[repo]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does repo do in gh?
Manage repositories.