Skip to content
Latchkey

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

  1. Place actions/checkout before the CodeQL init step.
  2. Do not remove the .git directory before analysis.
  3. Re-run so init finds a valid repository.
.github/workflows/codeql.yml
- uses: actions/checkout@v4
- uses: github/codeql-action/init@v3
  with:
    languages: python

Tell 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: src

How 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

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →