gitreadonlygit-notes

How to make sure others people cannot edit my git notes?


I want to make release notes by using git notes, but I am not sure if other people change my git notes by using the same ref.

BTW, chmod 444 .git/refs/notes/abc_test & .git/logs/refs/notes/abc_test does not work.


Solution

  • I don't think you really can protect published git notes.

    What you can do is put them in an explicit namespace, as mentioned in here:

    I think for "typical usage" one stores others' notes in a different place anyways, e.g. I store Thomas' list-notes in refs/remotes/trast/notes/ so that they don't interfer with my own notes.

    If in the same namespace, then they can be merged:

    git checkout refs/notes/commits
    git fetch origin refs/notes/commits
    git merge FETCH_HEAD
    git update-ref refs/notes/commits HEAD
    git checkout master
    

    But that would change their content.