git clone -b master --single-branch --depth 1 --recursive --shallow-submodules https://gitlab.com/hogehoge/hogehoge.git
-b master | ブランチ指定 (例ではmasterを指定) |
--simgle-branch | 指定したブランチだけclone |
--depth 1 | 1階層(最新)だけclone |
--recursive | サブモジュールも再帰的にclone |
--shallow-submodules | サブモジュールのcloneも最新だけにする |
Git - git-clone Documentation
git のクローンを最小量にする(サブモジュールを含めたshallow clone) - Qiita
Git - 特定のブランチをクローンする | git Tutorial
[Git] とにかく速く特定のブランチをgit cloneしたい場合のTips - Qiita
毎回ユーザ名とパスワードを聞かれないよう覚えさすには次の設定を ~/.gitconfig に足しておく
[credential] # helper = cache --timeout 36000 helper = store --file /tmp/git-credentials
git config --global credential.helper store --file /tmp/git-credentials
とりあえず、電源を入れている間はパスワードを覚え続けてもらう設定にした。
これを書かないと、サブモジュールでも毎回パスワードを聞いてくる
2020-10-13 追記
最初の1回も聞かれたくないときは、URLのドメインの前に ログインID:パスワード@ を書いちゃう。
パスワードを覚えさせる設定はこれも記憶してくれる
git clone -b master --single-branch --depth 1 --recursive --shallow-submodules \ https://username:password@gitlab.com/hogehoge/hogehoge.git