How do I resolve GitHub showing 'Empty repository' after pushing initial commits?
An 'Empty repository' message after pushing often indicates a failed push or missing files. Verify commit history and push with force if necessary.
When GitHub shows 'Empty repository' after pushing initial commits, it usually indicates that the push did not successfully transfer the files, or the local commit history lacks the necessary commits. First, check your local repository’s commit history with git log
to confirm that commits are present. If your branch is ahead locally, use git push origin main
(or your default branch) to push any changes to GitHub. In some cases, forcing the push (git push -f
) may be necessary, especially if you rebased or modified commit history after the initial push attempt. Confirming your repository’s content and performing a successful push updates GitHub’s display, resolving the 'Empty repository' issue.