CodeQL "checkout path ... does not appear to be a git repository" in CI
CodeQL reads git metadata from the checkout to associate results with commits and files. If the working directory has no .git (checkout did not run, or ran with a different path), init fails immediately.
What this error means
The init step fails with "The checkout path provided to the action does not appear to be a git repository." No analysis runs.
CodeQL
Error: The checkout path provided to the action does not appear to be a git repository.
Please check the path and try again. (checkout_path: /home/runner/work/app/app)Common causes
CodeQL init runs before checkout
The init step executes before actions/checkout, so there is no repository on disk yet.
A custom checkout path CodeQL was not told about
Checkout used a non-default path, but CodeQL still looks at the default workspace, which is not a git repo.
How to fix it
Check out before init
- Place actions/checkout before the CodeQL init step.
- Do not remove the
.gitdirectory before analysis. - Re-run so init finds a valid repository.
.github/workflows/codeql.yml
- uses: actions/checkout@v4
- uses: github/codeql-action/init@v3
with:
languages: pythonTell CodeQL about a custom checkout path
If checkout uses a non-default path, pass the same path to the CodeQL action so it reads the right repository.
.github/workflows/codeql.yml
- uses: actions/checkout@v4
with:
path: src
- uses: github/codeql-action/init@v3
with:
languages: python
source-root: srcHow to prevent it
- Always run checkout before CodeQL init.
- Keep the .git directory intact through analysis.
- Pass matching paths when using a custom checkout location.
Related guides
CodeQL "Config file ... does not exist" configuration error in CIFix CodeQL "1 configuration error: Config file ... does not exist" in CI - the config-file path passed to the…
CodeQL "Could not auto-detect a suitable build method" in CIFix CodeQL "Could not auto-detect a suitable build method" in CI - autobuild could not infer how to compile a…
CodeQL "No source code was seen during the build" in CIFix CodeQL "No source code was seen during the build" / "CodeQL did not detect any code" in CI - the extracto…