---
name: Private Code Search
slug: private-code-search
category: Automation
description: "Private Code Search mirrors your GitHub repositories to a local directory and runs ripgrep for fast full-text search across all of them, including private ones. Use it when you need to find which repository contains a snippet and GitHub's API search fails on private repos."
github: "https://github.com/ykdojo/claude-code-tips/tree/main/skills/private-github-search"
language: HTML
stars: 9620
forks: 764
install: "npx degit https://github.com/ykdojo/claude-code-tips/tree/main/skills/private-github-search ~/.claude/skills/private-github-search"
installs_to: ~/.claude/skills/private-github-search
source_path: skills/private-github-search/SKILL.md
collection_size: 9
category_size: 1523
collection_url: "https://dirskills.com/collections/ykdojo/claude-code-tips"
added: 2026-08-15T06:50:37.942Z
last_synced: 2026-08-15T06:50:37.942Z
canonical_url: "https://dirskills.com/skills/private-code-search"
---

# Private Code Search

Private Code Search mirrors your GitHub repositories to a local directory and runs ripgrep for fast full-text search across all of them, including private ones. Use it when you need to find which repository contains a snippet and GitHub's API search fails on private repos.

**Install:**

```bash
npx degit https://github.com/ykdojo/claude-code-tips/tree/main/skills/private-github-search ~/.claude/skills/private-github-search
```

## README

# 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):

```bash
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
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.
