Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"warning: adding embedded git repository" when adding a new create-react-app folder

Tags:

git

I just want to simply git add my React project to my class Gitlab, but I get a warning:

saying:
warning: adding embedded git repository: frontend-Projekt
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.
hint: If you meant to add a submodule, use:
hint:
hint:   git submodule add <url> frontend-Projekt
hint:
hint: If you added this path by mistake, you can remove it from the
hint: index with:
hint:
hint:   git rm --cached frontend-Projekt
hint:
hint: See "git help submodule" for more information.

I don't understand what I did wrong. Can someone help me? Or maybe tell me how to restart git bash so it would work normally again, because I tried reinstalling it and the warning still occurs.

like image 495
sheeshwarrior Avatar asked Jan 29 '26 16:01

sheeshwarrior


1 Answers

You were already in a Git repo when you ran npx create-react-app …. This creates a new React app in a new Git repo.

Now you have a Git repo in a Git repo — not what you want.

  1. git reset the .git folder in the React app’s folder to undo the git add.
  2. Delete the .git folder from the React app folder.

Also see Why is a .git folder automatically being created when creating a react app?

like image 188
grg Avatar answered Feb 01 '26 11:02

grg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!