gitingest README

The project's README from github.com/coderamp-labs/gitingest. As one markdown file: README.md.

Gitingest

Screenshot of Gitingest front page

PyPI Python Versions
CI

Ruff OpenSSF Scorecard
License Downloads GitHub Stars Discord
Trendshift

Turn any Git repository into a prompt-friendly text ingest for LLMs.

You can also replace hub with ingest in any GitHub URL to access the corresponding digest.

gitingest.com · Chrome Extension · Firefox Add-on

Deutsch | Español | Français | 日本語 | 한국어 | Português | Русский | 中文

🚀 Features

📚 Requirements

📦 Installation

Gitingest is available on PyPI. You can install it using pip:

pip install gitingest

or

pip install gitingest[server]

to include server dependencies for self-hosting.

However, it might be a good idea to use pipx to install it. You can install pipx using your preferred package manager.

brew install pipx
apt install pipx
scoop install pipx
...

If you are using pipx for the first time, run:

pipx ensurepath
# install gitingest
pipx install gitingest

🧩 Browser Extension Usage

Available in the Chrome Web Store Get The Add-on for Firefox Get from the Edge Add-ons

The extension is open source at lcandy2/gitingest-extension.

Issues and feature requests are welcome to the repo.

💡 Command line usage

The gitingest command line tool allows you to analyze codebases and create a text dump of their contents.

# Basic usage (writes to digest.txt by default)
gitingest /path/to/directory

# From URL
gitingest https://github.com/coderamp-labs/gitingest

# or from specific subdirectory
gitingest https://github.com/coderamp-labs/gitingest/tree/main/src/gitingest/utils

For private repositories, use the --token/-t option.

# Get your token from https://github.com/settings/personal-access-tokens
gitingest https://github.com/username/private-repo --token github_pat_...

# Or set it as an environment variable
export GITHUB_TOKEN=github_pat_...
gitingest https://github.com/username/private-repo

# Include repository submodules
gitingest https://github.com/username/repo-with-submodules --include-submodules

By default, files listed in .gitignore are skipped. Use --include-gitignored if you need those files in the digest.

By default, the digest is written to a text file (digest.txt) in your current working directory. You can customize the output in two ways:

See more options and usage details with:

gitingest --help

🐍 Python package usage

# Synchronous usage
from gitingest import ingest

summary, tree, content = ingest("path/to/directory")

# or from URL
summary, tree, content = ingest("https://github.com/coderamp-labs/gitingest")

# or from a specific subdirectory
summary, tree, content = ingest("https://github.com/coderamp-labs/gitingest/tree/main/src/gitingest/utils")

For private repositories, you can pass a token:

# Using token parameter
summary, tree, content = ingest("https://github.com/username/private-repo", token="github_pat_...")

# Or set it as an environment variable
import os
os.environ["GITHUB_TOKEN"] = "github_pat_..."
summary, tree, content = ingest("https://github.com/username/private-repo")

# Include repository submodules
summary, tree, content = ingest("https://github.com/username/repo-with-submodules", include_submodules=True)

By default, this won't write a file but can be enabled with the output argument.

# Asynchronous usage
from gitingest import ingest_async
import asyncio

result = asyncio.run(ingest_async("path/to/directory"))

Jupyter notebook usage

from gitingest import ingest_async

# Use await directly in Jupyter
summary, tree, content = await ingest_async("path/to/directory")

This is because Jupyter notebooks are asynchronous by default.

🐳 Self-host

Using Docker

  1. Build the image:

    docker build -t gitingest .
    
  2. Run the container:

    docker run -d --name gitingest -p 8000:8000 gitingest
    

The application will be available at http://localhost:8000.

If you are hosting it on a domain, you can specify the allowed hostnames via env variable ALLOWED_HOSTS.

# Default: "gitingest.com, *.gitingest.com, localhost, 127.0.0.1".
ALLOWED_HOSTS="example.com, localhost, 127.0.0.1"

Environment Variables

The application can be configured using the following environment variables:

Using Docker Compose

The project includes a compose.yml file that allows you to easily run the application in both development and production environments.

Compose File Structure

The compose.yml file uses YAML anchoring with &app-base and <<: *app-base to define common configuration that is shared between services:

# Common base configuration for all services
x-app-base: &app-base
  build:
    context: .
    dockerfile: Dockerfile
  ports:
    - "${APP_WEB_BIND:-8000}:8000"  # Main application port
    - "${GITINGEST_METRICS_HOST:-127.0.0.1}:${GITINGEST_METRICS_PORT:-9090}:9090"  # Metrics port
  # ... other common configurations

Services

The file defines three services:

  1. app: Production service configuration

    • Uses the prod profile
    • Sets the Sentry environment to "production"
    • Configured for stable operation with restart: unless-stopped
  2. app-dev: Development service configuration

    • Uses the dev profile
    • Enables debug mode
    • Mounts the source code for live development
    • Uses hot reloading for faster development
  3. minio: S3-compatible object storage for development

    • Uses the dev profile (only available in development mode)
    • Provides S3-compatible storage for local development
    • Accessible via:
    • Default admin credentials:
      • Username: minioadmin
      • Password: minioadmin
    • Configurable via environment variables:
      • MINIO_ROOT_USER: Custom admin username (default: minioadmin)
      • MINIO_ROOT_PASSWORD: Custom admin password (default: minioadmin)
    • Includes persistent storage via Docker volume
    • Auto-creates a bucket and application-specific credentials:
      • Bucket name: gitingest-bucket (configurable via S3_BUCKET_NAME)
      • Access key: gitingest (configurable via S3_ACCESS_KEY)
      • Secret key: gitingest123 (configurable via S3_SECRET_KEY)
    • These credentials are automatically passed to the app-dev service via environment variables:
      • S3_ENDPOINT: URL of the MinIO server
      • S3_ACCESS_KEY: Access key for the S3 bucket
      • S3_SECRET_KEY: Secret key for the S3 bucket
      • S3_BUCKET_NAME: Name of the S3 bucket
      • S3_REGION: Region for the S3 bucket (default: us-east-1)
      • S3_ALIAS_HOST: Public URL/CDN for accessing S3 resources (default: "127.0.0.1:9000/gitingest-bucket")

Usage Examples

To run the application in development mode:

docker compose --profile dev up

To run the application in production mode:

docker compose --profile prod up -d

To build and run the application:

docker compose --profile prod build
docker compose --profile prod up -d

🤝 Contributing

Non-technical ways to contribute

Technical ways to contribute

Gitingest aims to be friendly for first time contributors, with a simple Python and HTML codebase. If you need any help while working with the code, reach out to us on Discord. For detailed instructions on how to make a pull request, see CONTRIBUTING.md.

🛠️ Stack

Looking for a JavaScript/FileSystemNode package?

Check out the NPM alternative 📦 Repomix: https://github.com/yamadashy/repomix

🚀 Project Growth

Star History Chart

gitingest (coderamp-labs/gitingest)

Searching Database…

15.9K ·GitHub
这是什么?Gitingest 可以把任意 Git 仓库转换成便于输入大语言模型(LLM)的文本摘要。你也可以直接把 GitHub 网址中的 'hub' 换成 'ingest'(例如 github.com -> gitingest.com),即可立即获得该摘要。
这是网站、命令行工具,还是函数库?三者都是:gitingest.com 上有在线网站,可以用 pip 安装的命令行工具,还有可以在自己代码中导入使用的 Python 包,另外还提供 Chrome 和 Firefox 浏览器扩展。
我怎样从仓库获取摘要?先用 'pip install gitingest' 安装(或使用 pipx),然后对仓库网址或本地目录运行 'gitingest' 命令。默认情况下,输出会写入 digest.txt,但你也可以用 -o 指定其他文件,或加上 -o - 把结果输出到 STDOUT。
我需要 GitHub 令牌才能使用吗?只有私有仓库需要,此时通过 --token/-t 传入 GitHub 个人访问令牌(Personal Access Token)。
它会包含 .gitignore 中列出的文件吗?不会。默认情况下,.gitignore 中列出的内容都会被跳过;如果要把这些文件纳入摘要,需要传入 --include-gitignored。
摘要中除了原始代码,还包含什么?摘要还包括文件和目录结构的统计信息、提取内容的大小,以及 token 数量,方便你了解它会占用多少上下文。
我能不用 gitingest.com,而是把它作为自托管服务运行吗?可以。项目提供了 Docker 镜像和带有 dev/prod 配置档的 compose.yml;应用基于 FastAPI 运行,可选择兼容 S3 的存储(MinIO),并支持 Prometheus/Sentry 监控。
有没有对应的 JavaScript 版本?README 推荐 Repomix 作为 NPM 替代方案,适合需要基于 FileSystemNode/JS 版本而非 Python 工具的用户。
我能在 Jupyter 笔记本中使用它吗?可以,以 Python 包的形式使用,不过需要用它的异步版本,因为笔记本默认会运行事件循环。
Size
1.5 MB
Stars
15.9K
Age
1y
Commits · 90 Days