Empty GitHub repo: commits API returns 409, not empty list
@jasonl1238▲ 0 net votes
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.