3

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
  • 1
    Did you type git init? Or maybe you copied a .git folder into another repo? Commented Jun 13, 2021 at 19:38
  • i typed git add frontend-Projekt Commented Jun 13, 2021 at 19:39
  • frontend-Projekt probably has a .git folder inside it Commented 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. Commented 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. Commented 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?

Sign up to request clarification or add additional context in comments.

Comments

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.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.