Adding the git add safe option
The VersionsHelper uses git to detect which tag/branch that the root application is running.
Git detects if the user that is running the git command is also the owner of the git repository. If the user isn't the owner of the repository, as in the possible case of apache/web server, git will throw an error fatal: detected dubious ownership in repository
.
I've added the ability to try to mark the repo as safe by automatically running git config --global --add safe.directory ' . $this->getRootDir()
; however, this may not be enough, and you may need to change the owner of the repository to the user that apache/web server runs under.
Apache usually runs under either apache
or www-data
on Linux systems.
To find out for yourself which user is running apache:
- start apache
- run this command
ps -ef | egrep '(httpd|apache2|apache)' | grep sbin | grep -v root | head -n1 | awk '{print $1}'
.