git-repo-detection
Claude Code git-repo-detection 技能:从 Git remote 读取 GitHub 仓库名
EnglishClaude Code 安装步骤
- 从下方 GitHub 原文打开固定提交,在同一提交中取得 `git-plugin/skills/git-repo-detection/` 技能目录。
- 将目录复制到项目内的 `.claude/skills/git-repo-detection/`,确认 `SKILL.md` 与附带文件位于该目录。
- 在项目根目录启动 Claude Code,直接描述下方示例中的任务,让 Claude 按需加载技能。
中文摘要
从仓库配置的 HTTPS 或 SSH 远程地址识别 GitHub 的所有者和仓库名,便于后续明确指定操作目标。
SKILL.md 中文导读
可复现示例
在练习仓库添加 `git remote add origin git@github.com:example-org/sample-catalog.git`。请 Claude 查看 origin,并只输出识别到的仓库标识。工作步骤
- 读取当前 Git 仓库的远程地址。
- 从选中的 GitHub remote 提取所有者和仓库名。
- 用原始配置复核标识。
验收方法
输出 `example-org/sample-catalog`。可以将其与 `git remote get-url origin` 中的路径部分手动核对。
GitHub 原文 · 更新日期
适用环境
Claude Code、Git 与本地练习仓库。示例只读取 origin,无需连接远程。
常见问题
识别仓库名是否需要 GitHub 登录?
读取本地 remote 配置并提取所有者和仓库名不需要 GitHub 登录。查询远程仓库数据可能需要额外授权。