# OpenGist — Self-Hosted Pastebin Powered by Git > OpenGist is a self-hosted pastebin alternative that stores snippets as Git repositories, enabling versioning, forking, and search across all your pastes. ## Install Save in your project root: # OpenGist — Self-Hosted Pastebin Powered by Git ## Quick Use ```bash docker run -d --name opengist -p 6157:6157 -p 6156:6156 -v $HOME/.opengist:/opengist ghcr.io/thomiceli/opengist:1 # Open http://localhost:6157 ``` ## Introduction OpenGist is a self-hosted, open-source pastebin service that uses Git under the hood. Every gist is a full Git repository, so you get version history, diffs, and the ability to clone or push snippets from the command line. ## What OpenGist Does - Hosts code snippets and text pastes with syntax highlighting for 250+ languages - Stores each gist as a Git repository with full version history - Supports public, unlisted, and private visibility levels - Provides a search engine across all gists with full-text indexing - Enables user accounts with SSH key authentication for Git push/pull ## Architecture Overview OpenGist is a single Go binary that embeds a web server, a Git backend, and a SQLite or PostgreSQL database for metadata. The web frontend is built with server-side rendered templates. Each gist maps to a bare Git repository on disk, and the application exposes both HTTP and SSH endpoints for Git operations. ## Self-Hosting & Configuration - Deploy via Docker or download the single binary for Linux, macOS, or Windows - Configure with environment variables or a YAML config file - Set `OG_EXTERNAL_URL` to your public domain for correct link generation - Use SQLite for small deployments or PostgreSQL for larger instances - Place behind a reverse proxy with TLS for production use ## Key Features - Git-native storage means every paste supports branching, cloning, and history - Syntax highlighting via Chroma covers 250+ languages and formats - Embeddable gists with JavaScript or iframe snippets - OAuth login support for GitHub, Gitea, and OpenID Connect providers - Lightweight single binary with minimal resource requirements ## Comparison with Similar Tools - **GitHub Gist** — cloud-hosted, proprietary; OpenGist is fully self-hosted - **PrivateBin** — encrypted pastes but no Git versioning; OpenGist tracks history - **Hastebin** — simple paste server; lacks user accounts and Git integration - **Gitea Gists** — built into Gitea; OpenGist is standalone and lighter - **dpaste** — minimal Python pastebin; OpenGist offers richer features ## FAQ **Q: Can I migrate existing GitHub Gists to OpenGist?** A: Yes. OpenGist can clone gists from GitHub since each gist is a standard Git repo. **Q: Does OpenGist support private pastes?** A: Yes. Gists can be set to public, unlisted, or private per user preference. **Q: What database backends are supported?** A: SQLite (default, zero-config) and PostgreSQL for larger deployments. **Q: How do I push a gist from the command line?** A: Add your SSH key in settings, then use `git push` to the gist SSH URL shown on each gist page. ## Sources - https://github.com/thomiceli/opengist - https://opengist.thomice.li --- Source: https://tokrepo.com/en/workflows/asset-6420941d Author: AI Open Source