291 words
1 minutes
Codex Needs Initialization | Fixing GitHub Repository Error in Codex

A while ago, OpenAI’s Codex became available to Plus users as well. I had been contemplating “I want to use Codex, should I subscribe?” after seeing reviews from Pro users, so I was absolutely thrilled.

I tried out Codex to check its usability, but I ran into an unexpected trap, so I’m leaving this note for reference.

What is Codex#

A cloud-based software engineering agent developed by OpenAI. The initial version uses a model called codex-1, which is based on the o3 foundation model.

Error: Simply Creating a GitHub Repository Isn’t Enough#

When I created a GitHub repository and tried to have it build an app by entering a prompt, the following error occurred:

“GitHub repository needs to be initialized for use within Codex.”

Screenshot of Codex initialization error message

I was puzzled, thinking “The repository exists, so what does initialization mean?” But the solution is simple: add a README and commit once.

Solution Steps#

IMPORTANT

The issue can be resolved by adding a README file and committing it. Choose one of the following methods:

Method 1: Using GUI#

In the GitHub repository screen, click the + button, then Add file → Create new file, create README.md, and click “Commit new file” (the content can be anything).

Method 2: Using Local Development#

Create README.mdgit add README.md && git commit -m "docs: add README"git push origin main (or your default branch name).

Common: Re-run in Codex#

Run the prompt again in Codex, and the error will be resolved.

Conclusion#

After adding a README and committing it, the error no longer occurs.

Codex screen after error resolution

It makes sense that an LLM doesn’t work well without input, but I think the system could have prepared this automatically… Still, Codex is incredibly useful. I’m planning to write a tutorial article for fun later.

Here’s the GitHub repository I used for this:

badsparky
/
test-codex
Waiting for api.github.com...
00K
0K
0K
Waiting...
Codex Needs Initialization | Fixing GitHub Repository Error in Codex
https://naonao-na.com/en/posts/codex-error-initialize/
Author
[object Object]
Published at
2025-06-21