All posts
AI Engineering·6 min read·Updated 18 Sept 2026

GitHub Repo to Prompt: Turn Any Repository into LLM-Ready Text (2026)

Quick answer
To turn a GitHub repo into LLM-ready text, run npx repomix --remote user/repo, which packs the whole repository into one file with token counts, or replace "hub" with "ingest" in any GitHub URL to get a Gitingest digest. Use include patterns or --compress to fit the result inside your model's context window.

How to turn a GitHub repository into a single prompt-ready text file for ChatGPT, Claude or Gemini with Repomix or Gitingest — commands, output formats, token counts and privacy.

Piyush Jangir
Verified author

Founder of StackPicks. Self-taught builder shipping open-source dev tools, marketing, and curator content since 2019. Based in Mumbai, India. Available on GitHub and LinkedIn.

6 min read
GitHub Repo to Prompt: Turn Any Repository into LLM-Ready Text (2026)

Short version: for a quick look at a public repo, use Gitingest by swapping "hub" for "ingest" in the URL. For anything you will repeat, or anything private, use Repomix from the command line. Either way, include less than you think: a focused pack beats a complete one. Commands below come from each project's README, checked on 18 September 2026.

Two ways to turn a GitHub repo into LLM-ready text

Option 1: Repomix

Repomix (about 28,000 stars, MIT) packs a repository into one AI-friendly file with token counts, respects .gitignore, and scans for secrets before writing output.

npx repomix                          # pack the current directory
npx repomix --remote user/repo       # pack a public GitHub repo
npx repomix --style markdown         # markdown instead of the default XML
npx repomix --compress               # keep structure, drop implementation detail

Option 2: Gitingest

Gitingest (about 15,500 stars, MIT) is the no-install option. Replace hub with ingest in any GitHub URL to open a digest in the browser. For private repositories or scripting, install the CLI:

pip install gitingest
gitingest https://github.com/user/repo

Repomix vs Gitingest compared

Making it fit

  1. Include only what the question needs.

- One package or directory, not the whole monorepo.

  1. Exclude the noise.

- Tests, fixtures, lockfiles, generated code and vendored dependencies.

  1. Compress if still too big.

- Repomix's --compress keeps signatures and structure.

  1. Stop packing past a certain size.

- For large codebases, give an agent a code index over MCP instead.

Before you paste

Check the output for secrets, even with a scanner, and check your employer's policy on sending source code to AI services. For day-to-day work inside a codebase, an agent with direct file access, as covered in our guide to reducing Claude Code token usage, is usually better than pasting a packed file into a chat.

Frequently asked questions

What is the easiest way to convert a GitHub repo to text?+

Gitingest's URL trick: take any public GitHub URL and replace "hub" with "ingest", so github.com becomes gitingest.com, and you get a prompt-friendly digest in the browser with nothing installed. For more control over which files are included and how the output is formatted, use Repomix from the command line with npx repomix --remote user/repo.

Can Repomix and Gitingest handle private repositories?+

Yes, run locally. Repomix packs whatever directory you run it in, so a private repository you have cloned works without extra setup. Gitingest's command-line tool, installed with pip install gitingest, can read private repositories when you supply a GitHub token. Avoid pasting private code into any hosted web tool unless your company policy allows it.

My repository is too big for the context window. What now?+

Narrow it. Include only the directories the question is about, exclude tests, fixtures, lockfiles and generated code, and use Repomix's --compress option, which keeps code structure while dropping implementation detail. If the codebase is genuinely large, packing is the wrong approach: a code index served over MCP, such as CodeGraph, lets an agent query only what it needs.

Is it safe to paste a packed repository into ChatGPT or Claude?+

Check for secrets first. Packed repositories can include API keys in config files or committed .env files. Repomix runs a secret scan and warns before output, which catches common mistakes, but it is not a guarantee. Also consider your employer's rules on sending source code to third-party AI services before pasting anything that is not your own.

Which output format should I use for an LLM?+

Repomix defaults to XML, which clearly separates files and works well with Claude. Markdown with --style markdown is easier to read yourself and works well with most models. JSON with --style json suits programmatic use. The format matters less than what you include: a focused 30,000-token pack beats an unfocused 300,000-token one on every model.

More in AI Engineering

GitHub Repo to Prompt: Turn Any Repository into LLM-Ready Text (2026) — StackPicks — StackPicks