ClawSkills logoClawSkills

gh

使用 GitHub CLI (gh) 执行核心 GitHub 操作:身份验证状态、仓库创建/克隆/派生、议题、拉取请求、发布版和基本仓库管理。触

介绍

# GitHub CLI (gh)

## 概述 使用 `gh` 在终端执行经过身份验证的 GitHub 操作。优先使用显式、幂等的命令,并将 URL 报告回用户。

## 快速检查 - 身份验证状态: ```bash gh auth status ``` - 当前仓库上下文: ```bash gh repo view --json nameWithOwner,url,defaultBranchRef ```

## 核心工作流

### 创建仓库(默认为私有) ```bash gh repo create OWNER/NAME --private --confirm --description "..." ``` 如果在本地仓库内运行,请使用 `--source . --remote origin --push`。

### 克隆 / 派生 ```bash gh repo clone OWNER/NAME ``` ```bash gh repo fork OWNER/NAME --clone ```

### Issues - 列出: ```bash gh issue list --limit 20 ``` - 创建: ```bash gh issue create --title "..." --body "..." ``` - 评论: ```bash gh issue comment <num> --body "..." ```

### Pull requests - 从当前分支创建: ```bash gh pr create --title "..." --body "..." ``` - 列出: ```bash gh pr list --limit 20 ``` - 查看: ```bash gh pr view <num> --web ``` - 合并(使用显式方法): ```bash gh pr merge <num> --merge ```

### 发布 ```bash gh release create vX.Y.Z --title "vX.Y.Z" --notes "..." ```

## 安全注意事项 - 在执行破坏性操作(删除、强制推送)之前,请确认目标仓库/所有者。 - 对于私有仓库,请确保在创建时设置 `--private`。 - 在自动化脚本中,优先使用 `--confirm` 以避免交互式提示。

更多产品