Git Nostr ToolsHow Git Nostr Tools integrates NIP-34 into Git, from remotes and pull requests to state announcements that independent testers can subscribe to.Read the articleClose the article
A few days ago, I announced Git Nostr Tools. I expected someone to ask how the tools compare to and interact with ngit, grasp, and Iris git. The automated response misses the point in several respects, so I want to explain the internals and motivation behind the tools a little bit.
Like ngit and nak git, git-nostr implements NIP-34. It should not be surprising that all three tools cover the same grounds. Also, the fact that multiple tools "claim" the nostr:// URL scheme is not a conflict, but the whole purpose of a standardized protocol. It is not true that the git-nostr repository lives on GitWorkshop. While its code is hosted on GitHub, its NIP-34 metadata is stored on two independent relays. The GitWorkshop project page is merely one place to view that metadata.
The difference that matters when choosing a tool is how it fits into the way you want to use Git. My claim is that by leaving choices like where to host your repositories, what to name your branches, and which command aliases to use up to you, git-nostr can fit into a wider range of workflows.
Command-line integration
nak provides a git subcommand. To clone a NIP-34 repository from a nostr:// URI with nak, you run nak git clone. ngit, on the other hand, provides a git-remote-nostr helper, so to clone a nostr:// URI with ngit, you just run git clone. But for other operations, you sometimes have to use the ngit command instead.
In contrast, git-nostr adds both a nostr remote helper and a nostr subcommand to git. This allows you to easily use git's functionality to define aliases for commands that you often use and to encode your personal preferences, like:
git config --global alias.fork 'nostr fork --interactive'
It fully integrates into the git ecosystem. It uses git config for configuration, git credential for storing your key, and respects your preferred editor setting when it needs you to edit a file.
To demonstrate how git-nostr works, I want to guide you through a few common operations and explain what happens internally.
Repository and state announcements
Let's assume that Alice owns an open-source project on GitHub. She has configured her local clone such that she will fetch via HTTPS and push via SSH. git remote --verbose shows her:
origin https://github.com/alice/widget.git (fetch)
origin git@github.com:alice/widget.git (push)
The .git/config file in her clone contains:
[remote "origin"]
url = https://github.com/alice/widget.git
pushurl = git@github.com:alice/widget.git
Alice wants to announce her project on Nostr, because Bob wants to contribute and refuses to open an account on GitHub. So first Alice configures a relay:
git config --global --add nostr.relay wss://nos.lol
She then runs the following command inside the clone of her project:
git nostr init widget --interactive
She has to pick a project identity. git-nostr does not try to derive a project identity from the name of the working directory or the remote URL. She picks widget as the identity of her project. Because she uses the --interactive option, her preferred editor that she also uses for writing git commit messages will open a file where she can customize the human-readable name of the project, its description and some other metadata. As soon as she saves the file and closes the editor, she will be prompted for a Nostr key, because this is the first time that git-nostr has to sign an event. She pastes a bunker:// URL that she got from an app on her mobile phone.
In the background, git-nostr signs and publishes a Repository Announcement note (kind 30617) with the metadata that Alice provided and the HTTPS fetch URLs (plural, there might be multiple) in the clone tag. It will also replace all URLs of the remote to a single nostr:// address and for each pushurl it creates special pushinsteadof entries.
The .git/config file now contains:
[remote "origin"]
url = nostr://<npub>/widget
[url "git@github.com:alice/widget.git"]
pushinsteadof = https://github.com/alice/widget.git
And if Alice invokes git push, the following happens behind the scenes:
gitrecognizes that the URL of the remote uses thenostr://scheme, so it invokesgit-remote-nostrand communicates with it overstdin/stdout. It tells the helper which URL to push to.git-remote-nostrresolves the Repository Announcement (kind 30617) from that address. It checks push permission and reads theclonetag. It then invokesgit pushwith the first clone URL, but withGIT_PROTOCOL_FROM_USER=0defined, because that URL was retrieved from the network.gitrecognizes that apushinsteadofentry is defined for the HTTPS URL from the announcement, so the git objects will be transferred via SSH.- Once the actual push was successful,
git-remote-nostrreads the repository state from the remote (which will be retrieved via HTTPS, because it is not a push operation) and it will publish that information as Repository State Announcement (kind 30618).
Here is where you might notice a difference from GRASP. GRASP requires the Repository State Announcement (kind 30618) before the push, while git-nostr sends it after. This is something that needs to be kept in mind when adding GRASP support to git-nostr.
And you might also notice what is relevant to Iris Git: Iris Git uses Hashtree for repository storage and a separate git-remote-htree helper for htree:// URLs. But if you had a htree:// URL in the Repository Announcement (kind 30617) or in a pushinsteadof rule in your local configuration, the GIT_PROTOCOL_FROM_USER=0 variable would prevent git from using that helper unless you explicitly allow it by setting protocol.htree.allow to always.
Collaboration
While ngit automatically opens a PR whenever you push a branch that begins with pr/, git-nostr does not have any opinion about branch names. Opening a PR is always explicit:
git nostr pr open nostr://bob@nip05.me/widget
The destination of a PR can be any nostr:// URL or a remote that has a nostr:// URL. It defaults to upstream.
Behind the scenes, opening a PR sends a Pull Request note (kind 1618) and associates the branch with its nevent. So after Alice executed the above command while on the fix-build branch, her .git/config would contain:
[branch "fix-build"]
remote = origin
merge = refs/heads/fix-build
nostr-pr = nevent1...
The branch's remote is origin, because that is where Alice pushes her changes. A branch can be associated with multiple PRs. It has one nostr-pr entry per associated PR.
If Alice pushes (potentially with --force) to a branch that is associated with one or more PRs, then git-remote-nostr (in addition to the stuff mentioned above) also sends a Pull Request Update note (kind 1619) for each associated PR.
Keep your existing workflow
git-nostr integrates NIP-34 into git, while staying out of your way where you don't want it to interfere. Host your source code and name your branches the way you like, be free to announce a project on Nostr or open a PR for a branch after it has been created, without the need to migrate anything.
This allows developers to collaborate on a feature of a project that is itself not announced on Nostr. They can send each other patches (kind 1617) and PRs (kinds 1618 and 1619) and once they agree with the state, open a PR on GitHub or wherever else upstream.
It also allows a project to start accepting Nostr issues and pull requests while GitHub continues to host the repository. It could then refer contributors to a page like GitWorkshop and disable pull requests on GitHub while keeping issues enabled, or vice versa. If their long-term plan was to get off GitHub, they could migrate issues, PRs, wiki, CI, and hosting on separate schedules.
Independent CI
In my talk Effective CTest at C++Now 2025, I advocated for a separation of responsibilities between project maintainers and build pipeline maintainers and I have my concerns about ngit's CI integration. To me, it looks like their goal is not to provide a decentralized development workflow like I described, but a decentralized version of GitHub, with all its feature bloat. I actually prefer the separation of concerns, which is also why I prefer native git with NIP-34 agnostic relays over GRASP.
Setting up a Nightly build for an arbitrary project and sending the build results to a dashboard was always possible and did not require permission from the project. This is what projects like VTK supported for 25 years. But what if you wanted to set up CI that builds for each opened PR or push to a particular branch? With GitHub, you would need to send a webhook to the tester, which only project maintainers can configure. With clients announcing the repository state (kind 30618), pull requests (kind 1618), and revisions (kind 1619), testers can simply listen for the appropriate events.































