LoginSignup
0
0

More than 3 years have passed since last update.

【git 初心者】cloneしてきたgithub repositoryに.gitmoduleが入っている場合の対処法

Last updated at Posted at 2020-05-13

概要

  • クローンしてきたレポジトリ内のPipfileからpipenv installを試みたがエラーになった.
  • 指定したパスに実行コマンドがないとのこと
  • .gitmoduleという見たことないファイルがあった
  • 調べたらsubmoduleといって,レポジトリ内で別のgitレポジトリを使う場合に記述があるらしい
  • .gitmoduleから,submoduleのパスの中身をクローンする必要があったのだがコマンドがあんまり載ってなかったからここにメモ

.gitmoduleの中身の例

[submodule "{path_to_rep}/{rep_name}"]
    path = {path_to_rep}/{rep_name}
    url = https://{rep_name}.git

{rep_name}: submoduleのレポジトリ名
{path_to_rep}/{rep_name}: submoduleのパス ここが最初にクローンしてきた状態では空のフォルダになっている

対処法

submoduleをクローンする

git submodule init
git submodule update

{path_to_rep}/{rep_name}の中を確認すると,サブモジュールのレポジトリがクローンされていることがわかる.

ちなみに,メインのレポジトリの変更にはならないので,コミットの差分はありません.

感想

複数レポジトリつなげたの初めてだったので,すこし戸惑った.
こんなの当たり前だろ!っていじめないでください m(_ _)m

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