github-info

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

GitHub Info

GitHub信息获取

Overview

概述

Retrieve comprehensive GitHub information using the GitHub CLI (
gh
) tool. This skill provides scripts and commands to fetch user profile data, repository statistics, and other GitHub-related information.
使用GitHub CLI(
gh
)工具获取全面的GitHub信息。本技能提供脚本与命令,用于获取用户资料数据、仓库统计信息及其他GitHub相关内容。

Prerequisites

前提条件

  • GitHub CLI (
    gh
    ) must be installed and authenticated
  • Run
    gh auth login
    if not already authenticated
  • 已安装并完成GitHub CLI(
    gh
    )的身份验证
  • 若未完成验证,请运行
    gh auth login

Quick Start

快速开始

Get Profile Information

获取资料信息

Use the
gh_profile.sh
script to retrieve your GitHub profile:
bash
bash scripts/gh_profile.sh
This displays:
  • Username, name, and bio
  • Company and location
  • Email and blog
  • Follower/following counts
  • Public repository and gist counts
  • Account creation and update dates
使用
gh_profile.sh
脚本获取你的GitHub资料:
bash
bash scripts/gh_profile.sh
该脚本会展示以下内容:
  • 用户名、姓名及个人简介
  • 公司与所在地
  • 邮箱及博客地址
  • 关注者/关注人数
  • 公开仓库与Gist数量
  • 账户创建及更新日期

Get Repository Information

获取仓库信息

Use the
gh_repos.sh
script to list your repositories:
bash
undefined
使用
gh_repos.sh
脚本列出你的仓库:
bash
undefined

Get 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 date
bash scripts/gh_repos.sh --sort created

该脚本会为每个仓库展示以下内容:
- 仓库名称及描述
- 主要开发语言
- Star与Fork数量
- 私有/公开状态
- 最后更新日期

Direct gh CLI Usage

直接使用gh CLI

For queries not covered by the scripts, use
gh
directly:
bash
undefined
对于脚本未覆盖的查询需求,可直接使用
gh
命令:
bash
undefined

Get 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'
undefined
gh api user/repos --paginate --jq '[.[] | .stargazers_count] | add'
undefined

Complete
gh
CLI Documentation

完整的
gh
CLI文档

Work 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
gh <command> <subcommand> --help
for more information about a command. Read the manual at https://cli.github.com/manual Learn about exit codes using
gh help exit-codes
Learn about accessibility experiences using
gh 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版本
了解更多 使用
gh <command> <subcommand> --help
获取命令的详细信息。 查看官方手册:https://cli.github.com/manual 使用
gh help exit-codes
了解退出码相关内容 使用
gh help accessibility
了解无障碍使用体验

Advanced Usage

进阶用法

For additional
gh
CLI patterns and commands, see references/gh_commands.md which includes:
  • Pull request and issue management
  • GitHub Actions workflow queries
  • Gist operations
  • Advanced API queries with
    jq
    filters
如需更多
gh
CLI的使用模式与命令,请查看references/gh_commands.md,其中包含:
  • Pull Request与Issue管理
  • GitHub Actions工作流查询
  • Gist操作
  • 使用
    jq
    过滤器的高级API查询

Resources

资源

scripts/

脚本目录/

  • gh_profile.sh
    - Get user profile information
  • gh_repos.sh
    - Get repository information with sorting options
  • gh_profile.sh
    - 获取用户资料信息
  • gh_repos.sh
    - 获取仓库信息并支持排序选项

references/

参考文档/

  • gh_commands.md
    - Comprehensive reference of useful
    gh
    CLI commands and patterns
  • gh_commands.md
    - 实用
    gh
    CLI命令与使用模式的综合参考文档