0
1

More than 3 years have passed since last update.

【Git】warning: adding embedded git repositoryの警告

Posted at

プログラミング勉強日記

2021年2月4日
Gitでaddしようとしたときに警告が出たのでこの対処法を備忘録としてまとめる。

警告内容

 ディレクトリをコピペでもってきて、それをaddしようとしたときに以下の警告が出た。持ってきたディレクトリに別のGitのレポジトリがあるので警告がでた。

image.png

$ git add .
warning: adding embedded git repository: public/room
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> public/room
hint:
hint: If you added this path by mistake, you can remove it from the
hint: index with:
hint:
hint:   git rm --cached public/room
hint:
hint: See "git help submodule" for more information.

解決方法

 原因のディレクトリの中で.gitファイルを消して、元のディレクトリに戻って再度addすると解決する。-rfは何のメッセージも表示されずに問答無用で削除し、元に戻せないので注意する。

// 原因のディレクトリの中で
$ rm -rf .git
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1