跳到正文
Skillpedia
通用编程10k · #11902

private-github-search

它能做什么

这个技能在你的 GitHub 仓库(包括私有仓库)的本地副本中搜索,找出代码或文字所在的位置。适合记不清某些内容在哪个仓库中的开发者。

适用场景

  • ✓当你记不清某段代码在你的哪个仓库中时。
  • ✓当你想在所有项目中找到你写过某个函数或设置的位置的时候。
  • ✓当 GitHub 自带的搜索在你的私有仓库中找不到结果的时候。

技能链接

https://github.com/ykdojo/claude-code-tips/blob/main/skills/private-github-search/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/ykdojo/claude-code-tips/blob/main/skills/private-github-search/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请在我所有的仓库中搜索,看看我把 Stripe webhook 处理程序放在哪里了。”

每周 5 个新技能,1 分钟读完。

工作原理

该技能保存你仓库主分支的本地副本,定期刷新,并在其上运行快速文本搜索。该副本只需设置一次,来源是你选择的 GitHub 账户。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Private GitHub search

GitHub's modern code search (the one that indexes private repos) is web-only; gh search code uses the legacy engine and often returns nothing for private repos. Instead, search a local mirror of all the user's repos - it covers the same content as GitHub's index (default branch, non-fork) and a full search takes milliseconds.

Searching

Find the bundled sync script (works for plugin installs and manual symlinks):

find ~/.claude ~/.codex -name "private-github-search-sync.sh" 2>/dev/null | sort -V | tail -1

Always refresh first - it exits instantly if the mirror was synced within the last hour, and takes ~15s otherwise (--force syncs regardless of age):

bash <script-path>
rg -il 'pattern' ~/repo-mirror/repos          # which files
rg -in 'pattern' ~/repo-mirror/repos | head   # matching lines

First-time setup

If ~/repo-mirror/owners.txt doesn't exist: ask the user which GitHub accounts to mirror (don't guess - they may manage several), write them one per line to ~/repo-mirror/owners.txt, then run the sync script in the background (initial clone takes a few minutes; needs gh auth with access to those accounts).

Caveats

  • Only the default-branch tip is mirrored - for history or other branches, use git log -S in a full clone or GitHub web search.
  • The mirror may contain private data: keep it out of synced folders and never commit or publish its contents.
常见问题

它会搜索旧的分支吗?

不会。它只涵盖每个仓库的主分支,搜索其他分支请使用 git log 或 GitHub 搜索。

它会搜索哪些账户?

只搜索你在设置时列出的 GitHub 账户,因此该技能会询问你要复制哪些账户。

本地副本可以安全共享吗?

副本可能包含私人数据,因此请将其放在不会被同步的文件夹之外。

详情

作者的原始描述

Full-text search across all of the user's GitHub repos (including private ones) using a local mirror and ripgrep. Use for "where did I put X", "which repo has X", or any search spanning the user's repos - gh search code / the REST API cannot reliably search private repos.

repo: ykdojo/claude-code-tips

热度

GitHub 星标
10k
排名
#11902
许可证
—
更新时间
2026/9/25

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能