github-info
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGitHub Info
GitHub信息获取
Overview
概述
Retrieve comprehensive GitHub information using the GitHub CLI () tool. This skill provides scripts and commands to fetch user profile data, repository statistics, and other GitHub-related information.
gh使用GitHub CLI()工具获取全面的GitHub信息。本技能提供脚本与命令,用于获取用户资料数据、仓库统计信息及其他GitHub相关内容。
ghPrerequisites
前提条件
- GitHub CLI () must be installed and authenticated
gh - Run if not already authenticated
gh auth login
- 已安装并完成GitHub CLI()的身份验证
gh - 若未完成验证,请运行
gh auth login
Quick Start
快速开始
Get Profile Information
获取资料信息
Use the script to retrieve your GitHub profile:
gh_profile.shbash
bash scripts/gh_profile.shThis displays:
- Username, name, and bio
- Company and location
- Email and blog
- Follower/following counts
- Public repository and gist counts
- Account creation and update dates
使用脚本获取你的GitHub资料:
gh_profile.shbash
bash scripts/gh_profile.sh该脚本会展示以下内容:
- 用户名、姓名及个人简介
- 公司与所在地
- 邮箱及博客地址
- 关注者/关注人数
- 公开仓库与Gist数量
- 账户创建及更新日期
Get Repository Information
获取仓库信息
Use the script to list your repositories:
gh_repos.shbash
undefined使用脚本列出你的仓库:
gh_repos.shbash
undefinedGet top 10 repositories (default)
获取前10个仓库(默认设置)
bash scripts/gh_repos.sh
bash scripts/gh_repos.sh
Get top 20 repositories
获取前20个仓库
bash scripts/gh_repos.sh --limit 20
bash scripts/gh_repos.sh --limit 20
Sort by creation date
按创建日期排序
bash scripts/gh_repos.sh --sort created
This displays for each repository:
- Repository name and description
- Primary language
- Star and fork counts
- Private/public status
- Last update datebash scripts/gh_repos.sh --sort created
该脚本会为每个仓库展示以下内容:
- 仓库名称及描述
- 主要开发语言
- Star与Fork数量
- 私有/公开状态
- 最后更新日期Direct gh CLI Usage
直接使用gh CLI
For queries not covered by the scripts, use directly:
ghbash
undefined对于脚本未覆盖的查询需求,可直接使用命令:
ghbash
undefinedGet specific user information
获取特定用户信息
gh api user --jq '.login, .name, .bio'
gh api user --jq '.login, .name, .bio'
List repositories with custom fields
列出包含自定义字段的仓库
gh repo list --json name,stargazerCount --jq '.[] | "(.name): (.stargazerCount) stars"'
gh repo list --json name,stargazerCount --jq '.[] | "(.name): (.stargazerCount) stars"'
Get total stars across all repos
获取所有仓库的总Star数
gh api user/repos --paginate --jq '[.[] | .stargazers_count] | add'
undefinedgh api user/repos --paginate --jq '[.[] | .stargazers_count] | add'
undefinedComplete gh
CLI Documentation
gh完整的gh
CLI文档
ghWork seamlessly with GitHub from the command line.
USAGE:
gh <command> <subcommand> [flags]CORE COMMANDS
auth: Authenticate gh and git with GitHub
browse: Open repositories, issues, pull requests, and more in the browser
codespace: Connect to and manage codespaces
gist: Manage gists
issue: Manage issues
org: Manage organizations
pr: Manage pull requests
project: Work with GitHub Projects.
release: Manage releases
repo: Manage repositories
GITHUB ACTIONS COMMANDS
cache: Manage GitHub Actions caches
run: View details about workflow runs
workflow: View details about GitHub Actions workflows
EXTENSION COMMANDS
copilot: Extension copilot
ALIAS COMMANDS
co: Alias for "pr checkout"
ADDITIONAL COMMANDS
alias: Create command shortcuts
api: Make an authenticated GitHub API request
attestation: Work with artifact attestations
completion: Generate shell completion scripts
config: Manage configuration for gh
extension: Manage gh extensions
gpg-key: Manage GPG keys
label: Manage labels
preview: Execute previews for gh features
ruleset: View info about repo rulesets
search: Search for repositories, issues, and pull requests
secret: Manage GitHub secrets
ssh-key: Manage SSH keys
status: Print information about relevant issues, pull requests, and notifications across repositories
variable: Manage GitHub Actions variables
FLAGS
--help Show help for command
--version Show gh version
LEARN MORE
Use for more information about a command.
Read the manual at https://cli.github.com/manual
Learn about exit codes using
Learn about accessibility experiences using
gh <command> <subcommand> --helpgh help exit-codesgh help accessibility从命令行无缝操作GitHub。
USAGE:
gh <command> <subcommand> [flags]核心命令
auth: 完成gh与git的GitHub身份验证
browse: 在浏览器中打开仓库、Issue、Pull Request等内容
codespace: 连接并管理Codespaces
gist: 管理Gist
issue: 管理Issue
org: 管理组织
pr: 管理Pull Request
project: 操作GitHub Projects
release: 管理发布版本
repo: 管理仓库
GitHub Actions命令
cache: 管理GitHub Actions缓存
run: 查看工作流运行详情
workflow: 查看GitHub Actions工作流详情
扩展命令
copilot: Copilot扩展
别名命令
co: "pr checkout"的别名
其他命令
alias: 创建命令快捷方式
api: 发起已验证的GitHub API请求
attestation: 处理制品证明
completion: 生成Shell补全脚本
config: 管理gh的配置
extension: 管理gh扩展
gpg-key: 管理GPG密钥
label: 管理标签
preview: 执行gh功能的预览版本
ruleset: 查看仓库规则集信息
search: 搜索仓库、Issue和Pull Request
secret: 管理GitHub密钥
ssh-key: 管理SSH密钥
status: 打印跨仓库的相关Issue、Pull Request及通知信息
variable: 管理GitHub Actions变量
参数
--help 显示命令帮助信息
--version 显示gh版本
了解更多
使用获取命令的详细信息。
查看官方手册:https://cli.github.com/manual
使用了解退出码相关内容
使用了解无障碍使用体验
gh <command> <subcommand> --helpgh help exit-codesgh help accessibilityAdvanced Usage
进阶用法
For additional CLI patterns and commands, see references/gh_commands.md which includes:
gh- Pull request and issue management
- GitHub Actions workflow queries
- Gist operations
- Advanced API queries with filters
jq
如需更多 CLI的使用模式与命令,请查看references/gh_commands.md,其中包含:
gh- Pull Request与Issue管理
- GitHub Actions工作流查询
- Gist操作
- 使用过滤器的高级API查询
jq
Resources
资源
scripts/
脚本目录/
- - Get user profile information
gh_profile.sh - - Get repository information with sorting options
gh_repos.sh
- - 获取用户资料信息
gh_profile.sh - - 获取仓库信息并支持排序选项
gh_repos.sh
references/
参考文档/
- - Comprehensive reference of useful
gh_commands.mdCLI commands and patternsgh
- - 实用
gh_commands.mdCLI命令与使用模式的综合参考文档gh