Kozea / Radicale

A simple CalDAV (calendar) and CardDAV (contact) server.
https://radicale.org
GNU General Public License v3.0
3.38k stars 440 forks source link

Git hook not working #1308

Open aashish108 opened 1 year ago

aashish108 commented 1 year ago

Hey, been trying to get this git hook working but it simply errors, saying:

[2023-06-14 08:54:43 +0000] [8/Thread-3 (process_request_thread)] [ERROR] An exception occurred during PUT request on '/aa101/bce08ad8-afcc-88b9-76eb-7251211807d3/f7911b3c-60be-4042-8b42-0b65af135b91.ics': Command '([ -d .git ] || git init) && git add -A && (git diff --cached --quiet || git commit -m "Changes by aa101")' returned non-zero exit status 128.

I have git inited the data folder (where the collections folder resides) btw. Not sure what I am doing wrong?

pbiering commented 1 year ago

Have you tested executing the whole provided command line as same user as radicale daemon is running? According to Internet search results, 128 is a fatal git exit code.

In case of SELinux is active check also the audit log.

aashish108 commented 1 year ago

Have you tested executing the whole provided command line as same user as radicale daemon is running? According to Internet search results, 128 is a fatal git exit code.

In case of SELinux is active check also the audit log.

It's running via Docker. Getting a bit complicated now lol, will have a check.

jan-krieg commented 1 year ago

Having just run into the same error, maybe you didn't set user.name and user.email in git for the user who's running the radicale daemon?

After setting the hook and modifying a calendar entry to trigger it, I got the same error message and found that while the .git/ folder got created and all the files added, no commit had been performed (indicating that the hook had failed at the last command). After manually editing the .git/config file to add user.name and user.email in the usual way, the hook is now running just fine.

As a consistency check, I've checked for a different user with shell access (but who has no .gitconfig) what happens when doing git init; git add test.txt; git commit - 'Initial commit' and found that this results in fatal: unable to auto-detect email address with error code 128, thus agreeing with the error code in the logs.

There's already some pull requests on the topic as the current documentation is lacking in this regard, see e.g. #883 #913 #914

pbiering commented 17 hours ago

covered by https://github.com/Kozea/Radicale/pull/1631