3

We need to lock odt files (binary files) from LibreOffice in GitHub (project documentation).

Lock seems not possible or very hacky, what are the best option or alternative solutions?

GibboK
  • 71,848
  • 143
  • 435
  • 658

1 Answers1

1

Write a pre-receive hook that checks inbound pushes, here's the basic full-inspection loop:

path=path/to/protected/file
while read old new ref; do              # for each pushed ref
        git rev-list $old..$new \
        | while read; do                # check for bad commits

                # test here, e.g. 
                test "`git rev-parse $REPLY:$path`" \
                   = "`git rev-parse v1.0:$path`" \
                || {
                        echo "** altered $path in $ref@$REPLY **"
                        exit 1
                }
                # end of this test

        done
done

Now nobody can push an altered version to your repo.

jthill
  • 55,082
  • 5
  • 77
  • 137