git submodule: already exists in the index

在 github 上面 clone 一个包含有 submodule 的 repo 的时候,用如下命令更新 submodule:

git submodule update --remote --merge

一直没法更新,尝试重新 add submodule,比如:

git submodule add  https://github.com/cisco/openh264 open_source_code/openh264

一直报如下错误:

'open_source_code/openh264' already exists in the index

执行如下命令,解决此问题:

git rm -r --cached open_source_code/openh264

你可能感兴趣的:(git submodule: already exists in the index)