artisan command always shows the message Not a git repository (or any of the parent directories)

8/20/2019

I have an app running with Docker and the .git directory is ignored to reduced the project's size.

The problem is that every time an artisan command is ran this message is displayed and stored inside the logs of Kubernetes. Moreover, in some cases is the reason why some kubernetes tasks cannot reach the HEALTHY status.

I have a Cronjob with kubernetes which reaches just 2/3 and the only message that the logs displayed is this one.

-- Jorge
artisan
git
kubernetes
laravel

1 Answer

8/21/2019

monicahq/monica PR 950 is an example of a workaround where the Sentry configuration is modified to test for the presence of the Git repository, ensuring php artisan config:cache is run only once.

// capture release as git sha
'release' => is_dir(__DIR__.'/../.git') ? trim(exec('git log --pretty="%h" -n1 HEAD')) : null,
-- VonC
Source: StackOverflow