LoginSignup
1
0

More than 3 years have passed since last update.

一度削除してしまったgit submoduleを再度追加する

Posted at

概要

ローカルリポジトリに追加しリモートにpushしたリポジトリ内のgit submoduleを諸事情で一度削除したが、再度追加しリモートにpushし直したいということがあった。
とりあえず、git submodule add で追加されたローカル上の.gitmodulesを消して、再度同コマンドで追加しようとしたら以下のようになった。

A git directory for 'リポジトリ名' is found locally with remote(s):
s  origin リポジトリURL
If you want to reuse this local git directory instead of cloning again from
  リポジトリURL
use the '--force' option. If the local git directory is not the correct repo
or you are unsure what this means choose another name with the '--name' option.

解決方法

  1. .gitフォルダ内のmodulesフォルダを削除する
  2. 同じく.gitフォルダ内のconfigファイル内の[submodule]の行を消す
  3. 再度 git submodule add で追加し、コミット、pushする

無事追加されました!

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