Post-commit git hook is not triggered by Logseq

for anyone else having this issue - i was able to debug that on Ubuntu Linux it was due to the snap package using AppArmor for security confinement and restricting access to anything ssh.

Tip for debugging to validate this is the same issue you are finding:
in your .git/hook/post-commit file, add the line git push 2>&1 | tee .git/hooks/post-commit.log.

This showed me the error (note Logseq respects the GIT_SSH_COMMAND env variable if you need to modify the key being used):

Git push failed ssh -i ~/.ssh/github: 1: ssh: Permission denied fatal: Could not read from remote repository.

i used snap list | grep logseq to validate my package was managed through snap. the command snap connect <snap-name>:ssh-keys worked to provide the privileges needed to access my key and then the syncing through github works!

for those with flatpak - the analogous commands should be as follows if memory serves correct

  • flatpak list | grep logseq
  • flatpak override --user --filesystem=home <flatpak-name>