Why Grasp?
Today’s Git hosting is centralized. Grasp flips the model: you pre-authorize pushes via signed Nostr events, then any compliant server can host your repo. Discover, push, and pull from multiple Grasp servers for resilience and censorship resistance.
Protocol Overview
Grasp defines two core services at a single HTTP(S) endpoint:
Smart HTTP Git service
- Repos live at
/<npub>/<identifier>.git - No user auth – pushes are validated against the latest signed Nostr state
- CORS origin
*allows web app access
Nostr Relay
- Auto-creates blank repos on repository-announcement events that list this instance
- Accepts events related to hosted repositories
This really simple foundation allows enables Nostr to become the authority and git servers to become dist…
Why Grasp?
Today’s Git hosting is centralized. Grasp flips the model: you pre-authorize pushes via signed Nostr events, then any compliant server can host your repo. Discover, push, and pull from multiple Grasp servers for resilience and censorship resistance.
Protocol Overview
Grasp defines two core services at a single HTTP(S) endpoint:
Smart HTTP Git service
- Repos live at
/<npub>/<identifier>.git - No user auth – pushes are validated against the latest signed Nostr state
- CORS origin
*allows web app access
Nostr Relay
- Auto-creates blank repos on repository-announcement events that list this instance
- Accepts events related to hosted repositories
This really simple foundation allows enables Nostr to become the authority and git servers to become distributed data relays. This empowers nostr clients to control the git experience, such as merging PRs.
Distributed Vision
Users have high expectations of Git servers. GitHub is performant, reliable, and has near 100% uptime. A self-hosted Git server can’t achieve that level of performance.
We can add resilience, reliability, and uptime by using Nostr events as the authority and treating Git servers like dumb data relays as we pull and push from multiple instances simultaneously. This way, users can achieve comparable reliability and uptime, even if some of the instances they use are occasionally down or misbehaving.
This approach prevents us from centralizing around a few performant Git servers and also allows maintainers to change Git servers without requiring their users to make any configuration changes.
To make this vision a reality, we need to encourage contributors and users to clone using the `nostr://` URL with the ngit plugin installed, rather than the `https://` URL of a single ngit-relay instance.
GRASP’s distributed architecture: Nostr events serve as the source of truth while multiple Git servers act as redundant data relays Open as full page ↗
Reference Implementation
ngit-relay is a grasp reference implementation that uses a Dockerized stack: nginx, git-http-backend and a Khatru relay.
Public Instances
How to Use
- Install the ngit plugin (v1.7+).
curl -Ls https://ngit.dev/install.sh | bash - Create a local repo:
git init
echo project > README.md
git add .
git commit -m "initial commit"
- Run
ngit initand follow prompts – it will:
- Send a Git-announcement event to your chosen ngit-relay instances.
- Emit a Git-state event.
- Add a
nostr://remote and push for you.
Subsequent git push operations broadcast to every server listed in the announcement. Repos are cloned via nostr:// for resilience and decentralisation.
optionally Deploy and host on your own instance on your VPS or self-host (see DEPLOYMENT.md in ngit-relay git repo).
FAQ
When Private Repos?
Add auth-to-read using NIP-42 plus a whitelist and run behind a firewall. For truly sensitive work, combine with protected-event support (NIP-70).
Further Information
Full protocol in grasp git repository
Reference Implementation ngit-relay website
long-form nostr article Vision for #GitViaNostr by DanConwayDev