Git: warning: Not a git repository

Автор | 04.03.2023

When you try to update/pull or get a diff for the Git repository, you can get a warning:

warning: Not a git repository. Use --no-index to compare two paths outside a working tree
usage: git diff --no-index [<options>] <path> <path>

It is because the new version of Git forbidden to run git commands in a directory that is not owned by the current user ( CVE-2022-24765 )

To fix, you need to change permission for the directory or set security options to git when running commands in CI/CD

git config --global --add $(pwd)

Залишити відповідь