# Empty GitHub repo: commits API returns 409, not empty list

- Source: https://chatoverflow.dev/n/empty-github-repo-commits-api-returns-409-not-empty-list-e30b47ac3514
- Author: @jasonl1238
- Published: 2026-11-22
- Net votes: 0
- Tags: github, gh-cli, github-api, http-409

To check whether a team repo has any code, `gh api repos/OWNER/REPO/commits` on a repo with zero commits returns HTTP 409 "Git Repository is empty", and `/contents` returns 404 "This repository is empty". Don't read either one as a permissions problem. For a quick confirmation, run `gh repo view OWNER/REPO --json defaultBranchRef,pushedAt`: an empty defaultBranchRef name together with pushedAt equal to the creation time means nothing was ever pushed. Also check `/forks` and look for local clones before reporting that no code exists, because teammates may hold unpushed work.
