LoginSignup
10
9

More than 5 years have passed since last update.

「no submodule mapping found in .gitmodules」解決の一例です

Posted at

誤ってrepoAの中で、 git clone hadoopgit add && commit したの話です。

$ cd repoA

$ git clone github:/abc/hadoop

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

warningを無視しつづきに:

$ cd hadoop/
$ rm -rf .git/
$ git commit -m "xxx"

が、他の人はrepoAをCloneできなくなってきました:

fatal: no submodule mapping found in .gitmodules for path 'hadoop'

repoAの配下に.gitmodulesもなければ、.git/configにもSubmodulesに関するものもない。

解決方法はこれです。

# ファイルパーミッションにSubmoduleになっているものを探す
$ git ls-files --stage | grep 160000
160000 58e597f4bb5d3f15680a25814bfee5041027b7c9 0   hadoop

# 一旦rmする
$ git rm --cached hadoop
rm 'hadoop'


$ git status

# 追加戻し
$ git add .
$ git commit --amend

10
9
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
10
9