Why Nostr? What is Njump?
2024-08-28 17:52:18

fiatjaf on Nostr: This is now implemented in and its companion pre-push hook: ...

This is now implemented in https://git.fiatjaf.com/song and its companion pre-push hook:
this is exactly what I was hoping for. the flow the current git remote helper is expecting is very similar to your video:
* song has a white list of npubs that can create repositories (just sk 79 in this example?)
* create git repo locally: `git init && echo "example" > README.md && git commit -am "initial commit"`
* create git announcement `ngit init --identifier my-repo --relays wss://git.oursong.com/npub123/my-repo --clone https://git.oursong.com/npub123/my-repo`
* `git remote add origin nostr://npub123/my-repo?relayhint=git.oursong.com | git push -u`
* song will receive the receive the state announcement nostr event which will authorise the push

Hopefully it will work with ngit soon, but it works without ngit now using just the pre-push hook:

mkdir flower
cd flower
git init

git remote add origin http://yoursongrelayandserver.com/flower
ln -s (which song-pre-push) .git/hooks/pre-push
git config song.signer '<nsec-or-bunker-url>'

echo 'peony' > name
git add .
git commit -m 'add name'
git push origin master -u

And the pre-push hook will sign a kind:30618 and push it to the server. The server will check that it comes from you and store it if it does, and will create a repository on its side upon receiving the event (named "flower"). Then the git push will proceed and since the kind:30618 has the correct branch name and the commit id in it, it will be authorized.

The next time you have a commit you can just git push and it should work normally.

Later you can publish a kind:30617 with more metadata if you want, and if that includes a "maintainers" tag then those maintainers can also create branches and push to your 'flower' repo.

I guess I should write this in the song README file.

you might be interested or have criticisms.
please let me know if I got this right.
Author Public Key
npub180cvv07tjdrrgpa0j7j7tmnyl2yr6yr7l8j4s3evf6u64th6gkwsyjh6w6