問題発生 / 意図せずSubModule / エラー原因は、Gitが管理しているレポジトリの重複

カテゴリー: Git BASH  閲覧数:202 配信日:2022-10-20 03:13


問題発生


「hoge」ディレクトリ追加後、「$ git add -A」コマンドを実行したら、「warning: adding embedded git repository: hoge」警告表示されました。
$ git add -A
warning: adding embedded git repository: hoge
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> hoge
hint:
hint: If you added this path by mistake, you can remove it from the
hint: index with:
hint:
hint:   git rm --cached hoge
hint:
hint: See "git help submodule" for more information.


意図せずSubModule


色々試行錯誤している内に、意図せずSubModuleが作成されてしまいました。
Githubのhogeフォルダに矢印が表示されています。
githubでフォルダに矢印が!やっと解決した話

$ git commit -m "public_html all"
fatal: 'git status --porcelain=2' failed in submodule hoge



エラー原因は、Gitが管理しているレポジトリの重複


新たに配置した「hoge」ディレクトリ内に、別のリポジトリが存在していたことがエラー原因
【Git】エラーの原因と対処法:warning: adding embedded git repository You’ve added another git repository inside your current repository

週間人気ページランキング / 1-30 → 2-5
順位 ページタイトル抜粋 アクセス数
1 ANRIとは? / ジェネラルパートナー株式会社 4
2 GitHubリモートリポジトリ名には日本語を使用できない。使用すると、ハイフンへ自動置換されてしまう | GitHub(Git) 3
3 Twitter API v1.1 | Twitter Developer(Twitter) 2
3 開発 0 2
3 意図せずSubModule(ディレクトリに白い矢印)が作成された場合は、「$ git rm -rf --cached <対象ファイル or path>」後、「$ git add <対象ファイル or path>」 | Git BASH(Git) 2
4 Phone number is already in use for too many accounts and cannot be added to another user. | Twitter Developer(Twitter) 1
4 コインチェック株式会社   | Webサービスビジネス 1
4 mhtmlの問題 / mhtmlで保存するのは何のため? / 欲しい拡張機能がないため、自分で作成するしかない 1
4 Windows10で使用できるGitクライアント | GitHub(Git) 1
4 同じ携帯電話番号でも、複数の「Twitter Developers」アカウントを作成可能 | Twitter Developer(Twitter) 1
4 Git BASH 作業履歴 2022/10/20 / P48 site-rank(First-Ranking-Service) 2 / P25をP48のリポジトリへ反映させていたので、「git push -f origin main」で強制上書き実行 | Git BASH(Git) 1
4 Twitter引用転載仕様調査 | Twitter Developer(Twitter) 1
4 Twitter 目次 | Twitter Developer(Twitter) 1
4 Git Bash で異なるディレクトリの指定ディレクトリへ移動する。「$ cd /L/3_開発/git/大阪府」 | Git BASH(Git) 1
2025/2/6 1:02 更新
指定期間人気ページランキング / 2020-5-27 → 2025-2-5
順位 ページタイトル抜粋 アクセス数
1 GitHubリモートリポジトリ名には日本語を使用できない。使用すると、ハイフンへ自動置換されてしまう | GitHub(開発環境) 1000
2 fatal: remote error: is not a valid repository name | Git BASH(開発環境) 717
3 Twitter アカウント管理 | Twitter Developer(Twitter) 611
4 動画対応 | プログラミング 588
5 Twitter API | Twitter API (Twitter) 584
6 開発 0 559
7 「Twitterデータ」対応 | Twitter Developer(Twitter) 538
8 本 | ブックマーク 440
9 Windows10で使用できるGitクライアント | GitHub(開発環境) 424
10 Webサービス | ブックマーク 417
11 マッチングサービス | Webサービスビジネス 402
12 同じ携帯電話番号でも、複数の「Twitter Developers」アカウントを作成可能 | Twitter Developer(Twitter) 340
13 TwitterOAuth では、画像URL を指定した画像投稿は出来ない(と思う)。ライブラリを使用しなければ出来るから、Twitter API の制限ではない(と思われる)  | Twitter 305
14 技術書籍 | プログラミング 298
15 気になった動画 | ブックマーク 290
16 teratailでは質問しない | プログラミング 284
17 埋め込みツイート | Twitter Developer(Twitter) 271
18 個人事業主 | Webサービスビジネス 250
19 Twitter 電話番号の問題 | Twitter Developer(Twitter) 223
20 過去の「0文字引用RT」を期間指定して取得しようとするも、挫折 | Twitter API (Twitter) 193
2025/2/6 1:02 更新