Tom
Tom

Reputation: 221

Can't add React project to Git repo

Currently working on a React app for a school project and need to be able to share the code with my team. I created the app using npx create-react-app app-name. I then try to add app-name to GitHub however I get the following:

hint: You've added another git repository inside your current repository.
hint: Clones of the outer repository will not contain the contents of
hint: the embedded repository and will not know how to obtain it.

Why can't I add this folder to GitHub like a regular folder? Is there a better way to share a React app with the team?

Thanks

Upvotes: 1

Views: 1250

Answers (1)

Jonathan Irwin
Jonathan Irwin

Reputation: 5747

Looks like you have 2 repos. Did you run git init more than once?

I would look in your project code for any .git folders and delete them.

This command will show you any git related files and folders:

find . -type d -name ".git" \
&& find . -name ".gitignore" \
&& find . -name ".gitmodules"

Move to your root project directory and run git init again.

Upvotes: 1

Related Questions