Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 807
Jorge Avatar asked Aug 20 '19 20:08

Jorge


People also ask

How do you fix not a git repository or any of the parent directories?

To do so, you need to navigate to the correct folder and then run the command git init , which will create a new empty Git repository or reinitialize an existing one.

Why am I getting not a git repository?

The “not a git repository” error is common. The cause is running a Git command in the wrong folder or running a Git command before initializing a Git repository.

Which of the following is not a git command?

git: 'remote-https' is not a git command. See 'git --help'.

What is Artisan CLI in laravel?

Artisan is the name of the command-line interface included with Laravel. It provides a number of helpful commands for your use while developing your application. It is driven by the powerful Symfony Console component.


1 Answers

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,
like image 95
VonC Avatar answered Oct 20 '22 14:10

VonC