1

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.

16
  • Did you type git init? Or maybe you copied a .git folder into another repo? Jun 13, 2021 at 19:38
  • i typed git add frontend-Projekt Jun 13, 2021 at 19:39
  • frontend-Projekt probably has a .git folder inside it Jun 13, 2021 at 19:39
  • 1
    The error says so warning: adding embedded git repository. Try using npx create-react-app --skip-git next time. Jun 13, 2021 at 19:53
  • 1
    No it's because there is a git repo inside another, hence the warning. npx create-react-app creates a git repo by default. Jun 13, 2021 at 19:59

2 Answers 2

3

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?

1

Simply delete the .git folder . Then go to root directory and open command prompt. type git add -A and hit enter. then git commit -m "removedembeddedgitfolder" and hit enter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.