We have an Upstart service/job that uses a local clone of a git repo. After relocating the data folder using a symbolic link we now get the following error message:
Failed to run 'git fetch' for /var/company/service/src/program repo; Details: fatal: Not a git repository (or any parent up to mount point /data) Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
How can I set GIT_DISCOVERY_ACROSS_FILESYSTEM for the service?
GIT_DISCOVERY_ACROSS_FILESYSTEM is an environmental variable that git looks for when trying to find the root of the repo. If that path exists on another filesystem, the command will produce the above error message to prevent git from crossing filesystem boundaries. You can set the value to true to allow this operation, and most init systems have ways to add environmental variables for a job/service.
For Upstart we just needed to update the /etc/init/servicename.conf file to include env and export keywords:
start on runlevel [2345]
stop on runlevel [^2345]
respawn
respawn limit 10 2
chdir /usr/local/servicename
setgid servicegroup
setuid servicename
limit nofile 1000000 1000000
env GIT_DISCOVERY_ACROSS_FILESYSTEM=true
export GIT_DISCOVERY_ACROSS_FILESYSTEM
exec /usr/local/servicename --cfg /etc/servicename.cfg >> /var/log/servicename.log 2>&1
After reloading the config and restarting the service, the git error message went away.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With