Closed ulzschkt closed 1 year ago
@ulzschkt You can try to configure it as a git system config. The system git config is managed on Linux systems at /etc/gitconfig
(!!! Watch that it is /etc/gitconfig
and NOT /etc/.gitconfig
!!!).
Run command sudo git config --system --add safe.directory /home/test
- sudo should enable write access to /etc/gitconfig.
All other users - at least www-data in your case - must have read access to this config file.
If you want to disable the safety check for any repo, you can run sudo git config --system --add safe.directory '*'
.
@ulzschkt Did my answer help to solve your issue or do you have any feedback?
close it for now. feel free to open it again
Hi. Sorry for my late response. I tried it but unfortunately i didnt solve the problem.
I added the file as proposed: -rw-r--r-- 1 root root 45 Sep 12 14:11 /etc/gitconfig
i holds the following content: [safe] directory = /home/test
@ulzschkt You have to make sure to add the directory where the .git folder is in! You should give it a try with the wildcard first!
sudo git config --system --add safe.directory '*'
If this works, you can try to restrict it to particular folders.
Hi! Thanks for your reply. My folder /home/test includes the .git folder already. I added the wildcard to /etc/gitconfig (as you suggested) and it worked. :) I dont know why it's not working when i restrict it to my folder, but the wildcard solution is also ok. Thank you!
Hi!
After trying every possible 'solution' i could find my problem is still there:
I have a debian-based server and dokuwiki is hosted by apache. The corresponding git-repo lies in a /home-directory and is owned by the user 'test' and the group 'test-grp'. The 'local.php' config of dokuwiki is correct and everything worked fine for many months. But last year there probably was a policy change in git which includes a proof of the repo-ownership. If it doesnt match with the currently executing user (of commit/push/...) git throws an error.
In dokuwiki the error message is as follows:
" DokuWiki Setup Error
Something unforeseen has happened: Git committing or pushing failed: fatal: detected dubious ownership in repository at '/home/test' To add an exception for this directory, call: git config --global --add safe.directory /home/test "
The obvious solution to add the directory as safe.directory does not work for several reasons. One is that www-data (or whoever executes the command) is no normal user and therefore has no .gitconfig or similar. I tried do add the proposed command to the git-options in the plugin configuration (in local.php) or to put a global .gitconfig (with the right content) somewhere in the filesystem and set environment variables like GIT_CONFIG, GIT_CONFIG_GLOBAL, ... to point there. For testing purposes i also added www-data to the user-group of the repo owner or moved the complete repo to the installation folder of dokuwiki (/var/www/html/dokuwiki) changed the ownership accordingly.
Nothing of this worked and i have no idea what i should do. Thanks for your help in advance.