LoginSignup
1
1

More than 3 years have passed since last update.

Git 管理下でgit clone をしたときに発生する不整合を直す

Posted at

起こったこと

Git管理下でgit clone すると面倒に。

Git管理しているプロジェクトなどでモジュール追加したくてgit cloneしたが、
ファイル自体は本体でバージョン管理したいから
git clone した階層の.git/ を手動で削除すると
本体gitのほうで不整合が生じる模様。

(Deployサーバーでエラーが出る。)

Failing build: Failed to prepare repo
Error checking out submodules: fatal: No url found for submodule path 'path-to-target' in .gitmodules
Failing build: Failed to prepare repo
failed during stage 'preparing repo': Error checking out submodules: fatal: No url found for submodule path 'path-to-target' in .gitmodules

解決策

以下のようにするととりあえず解決
(outputが出ないときもあるが。。)

$ git rm -r --cached --ignore-unmatch path-to-target/

あとは、普通にcommit すれば直るよう。

$ git commit

回避策は?

Git管理下でgit cloneしたいなら、

$ git submodule add https://github.com/sachiotomita/project path-to-target
$ git submodule deinit path-to-target
$ git rm path-to-target
$ # git config -f .gitmodules --remove-section submodule.path-to-target # もしgit v1.8.5 以前なら

するか、直接zipでダウンロードするしかないか。

1
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
1
1