Git hook that publishes repository state to Nostr (NIP-34)
npm install git-nostr-hook

Git hook that automatically publishes your repository state to Nostr (NIP-34) on every commit.
Decentralize your git repository announcements. Every commit publishes a Kind 30617 event to Nostr relays, making your repository discoverable across the Nostr network without relying solely on centralized platforms like GitHub.
- Node.js 18+
- Git 2.9+ (for core.hooksPath support)
``bash`
npm install -g git-nostr-hook
git-nostr-hook install
Set your Nostr private key:
`bash`
git config --global nostr.privkey <64-char-hex-key>
Generate a new key if needed:
`bash`
npx noskey
Once installed, every git commit automatically publishes a Kind 30617 event to Nostr relays.
Test the hook without committing:
`bash`
git-nostr-hook run
`
š” git-nostr-hook
Event ID: abc123...
Pubkey: def456...
ā Published to wss://relay.damus.io
ā Published to wss://nos.lol
ā Published to wss://relay.nostr.band
ā Published to 3/3 relays
`
The hook publishes a Kind 30617 (NIP-34 repository announcement) event containing:
| Tag | Description |
|-----|-------------|
| d | Repository identifier (repo name) |name
| | Repository name |HEAD
| | Current branch reference |clone
| | Git clone URL |web
| | Web URL (GitHub, etc.) |refs/heads/*
| | Branch refs with commit SHAs |
`json`
{
"kind": 30617,
"tags": [
["d", "my-project"],
["name", "my-project"],
["HEAD", "ref: refs/heads/main"],
["clone", "git@github.com:user/my-project.git"],
["web", "https://github.com/user/my-project"],
["refs/heads/main", "abc123..."]
],
"content": "Latest commit: Add new feature"
}
| Command | Description |
|---------|-------------|
| git-nostr-hook install | Install global git hook |git-nostr-hook uninstall
| | Remove global git hook |git-nostr-hook run
| | Run manually (for testing) |git-nostr-hook help
| | Show help |
1. Installs a post-commit hook to ~/.git-hooks/git config --global core.hooksPath ~/.git-hooks
2. Sets git config nostr.privkey
3. On every commit, the hook:
- Reads private key from
- Builds a Kind 30617 repository announcement event
- Signs with Schnorr signature (secp256k1)
- Publishes to default relays
- wss://relay.damus.iowss://nos.lol
- wss://relay.nostr.band
-
Set your private key:
`bash`
git config --global nostr.privkey
Verify the global hooks path is set:
`bash`
git config --global core.hooksPathShould output: ~/.git-hooks
Re-run install if needed:
`bash`
git-nostr-hook install
Check your internet connection and verify the relays are online. The hook will continue even if some relays fail.
If you have existing hooks in a repository's .git/hooks/, note that core.hooksPath takes precedence. You may need to manually call your other hooks from ~/.git-hooks/post-commit.
View your published events on Nostr clients that support NIP-34, or query directly:
`bash``Using nak (Nostr Army Knife)
nak req -k 30617 -a
This implements NIP-34 - Git repositories on Nostr.
Kind 30617 is a replaceable event (per NIP-01), so each commit updates the previous announcement rather than creating duplicates.
MIT