Jorge
Jorge

Reputation: 353

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

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.

Upvotes: 5

Views: 696

Answers (1)

VonC
VonC

Reputation: 1327364

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,

Upvotes: 5

Related Questions