# Gitingest — Feed Git Repos to AI Agents > Convert any GitHub repository into a single text file optimized for LLM consumption. Paste a URL, get clean context for Claude Code, ChatGPT, or any AI coding tool. ## Install Save as a script file and run: ## Quick Use ```bash pip install gitingest ``` ```python from gitingest import ingest summary, tree, content = ingest("https://github.com/cyclotruc/gitingest") print(tree) # File tree print(content) # All source code as one text ``` Or use the web UI at [gitingest.com](https://gitingest.com). ## What is Gitingest? Gitingest converts any GitHub repository into a single, LLM-optimized text file. It extracts the file tree and source code, filters out binaries and generated files, and produces clean context that fits into an AI conversation — perfect for code review, migration planning, or asking an AI to understand an entire codebase. **Answer-Ready**: Gitingest converts GitHub repositories into single text files optimized for LLM consumption. Extract file trees and source code from any repo, ready for Claude Code, ChatGPT, or any AI coding tool. Free web UI at gitingest.com. 8k+ GitHub stars. **Best for**: Developers who need to feed entire codebases into AI tools. **Works with**: Any LLM (Claude, GPT, Gemini), any GitHub repo. **Setup time**: Zero (web UI) or 1 minute (pip install). ## Core Features ### 1. Web UI Visit [gitingest.com](https://gitingest.com): 1. Paste any GitHub URL 2. Click "Ingest" 3. Copy the output into your AI conversation ### 2. Python API ```python from gitingest import ingest # Basic usage summary, tree, content = ingest("https://github.com/user/repo") # With filters summary, tree, content = ingest( "https://github.com/user/repo", include_patterns=["*.py", "*.ts"], exclude_patterns=["tests/*", "node_modules/*"], max_file_size=100000, # Skip files > 100KB ) ``` ### 3. CLI ```bash gitingest https://github.com/user/repo > repo_context.txt # With filters gitingest https://github.com/user/repo \ --include "*.py" \ --exclude "tests/*" \ --output context.txt ``` ### 4. Smart Filtering Automatically excludes: - Binary files (images, compiled code) - Lock files (package-lock.json, yarn.lock) - Generated code (dist/, build/) - Large files (configurable threshold) - Hidden files (.git/, .env) ### 5. Output Format ``` Repository: user/repo Files: 47 Total size: 125 KB Directory Structure: ├── src/ │ ├── main.py │ ├── utils.py │ └── models/ │ ├── user.py │ └── order.py ├── tests/ │ └── test_main.py └── README.md --- File: src/main.py --- [full file contents] --- File: src/utils.py --- [full file contents] ... ``` ## Use Cases | Use Case | How | |----------|-----| | Code review | Feed repo to AI for review | | Migration | "Convert this Flask app to FastAPI" | | Documentation | "Generate docs for this codebase" | | Learning | "Explain this project's architecture" | | Bug hunting | "Find potential bugs in this code" | ## FAQ **Q: Is the web UI free?** A: Yes, gitingest.com is free with no sign-up required. **Q: Does it work with private repos?** A: The Python library works with any git URL you have access to. The web UI requires public repos. **Q: How does it handle large repos?** A: Smart filtering reduces context size. You can also use include/exclude patterns to focus on specific directories. ## Source & Thanks > Created by [Cyclotruc](https://github.com/cyclotruc). Licensed under MIT. > > [cyclotruc/gitingest](https://github.com/cyclotruc/gitingest) — 8k+ stars ## 快速使用 ```bash pip install gitingest ``` 或直接访问 [gitingest.com](https://gitingest.com) 粘贴 GitHub URL。 ## 什么是 Gitingest? Gitingest 将 GitHub 仓库转为 LLM 优化的单文本文件。提取文件树和源代码,过滤二进制和生成文件。 **一句话总结**:将 GitHub 仓库转为 AI 友好的单文本文件,供 Claude、GPT 等 AI 工具消费,8k+ GitHub stars。 **适合人群**:需要将完整代码库喂给 AI 工具的开发者。 ## 核心功能 ### 1. Web UI 粘贴 URL → 点击 Ingest → 复制输出到 AI 对话。 ### 2. Python API 编程调用,支持文件过滤。 ### 3. 智能过滤 自动排除二进制、锁文件、生成代码。 ### 4. CLI 命令行一键生成上下文文件。 ## 常见问题 **Q: 免费吗?** A: Web UI 免费无需注册。 **Q: 支持私有仓库吗?** A: Python 库支持任何你有权限的 git URL。 ## 来源与致谢 > [cyclotruc/gitingest](https://github.com/cyclotruc/gitingest) — 8k+ stars, MIT --- Source: https://tokrepo.com/en/workflows/285a3eaf-ac14-4a36-b9d1-06eb1be04004 Author: Script Depot