無料のバージョン管理ソフト Git のクライアントソフト TortoiseGit を用いて、 PC 内に作成したリモートリポジトリを、新規作成した空のフォルダにクローン(複製)して、指定したリモートリポジトリのブランチをチェックアウトします。
その後、クローンだけではチェックアウトされないサブモジュールのファイル群をチェックアウトします。

※ TortoiseGit-2.17.0.2-64bit を使用します。
リモートリポジトリのクローン
リモートリポジトリのクローン(複製)を、新規作成した任意の空のフォルダに作成します。
そのフォルダをエクスプローラで開いて、右クリックで表示されるメニュー「Git クローン(複製)」を選択します。

「Git クローン」ダイアログが表示されます。
「すでに存在するリポジトリをクローン」枠の以下の2つの項目を指定します。
- 「URL」に、リモートリポジトリの URL
例では、PC 内に作成したリモートリポジトリのフォルダのパスを指定しました。
URL を指定する際は、「参照」ボタンを押すと、選択ダイアログが表示されます。
※▼ボタンから「開く」を選択すると、現在指定している URL がウェブブラウザで開かれました。 - 「ディレクトリ」に、クローン(複製)を作成するフォルダのパス
URL を指定すると、クローンを作成するフォルダの下に、リモートリポジトリと同じ名前ののフォルダが作成されます。
指定したら OK ボタンを押します。

This section talks about how to clone a git repository from an existing repository. This operation is used to get a full copy of a remote repository. Cloning a git repository is very simple. At an empty directory, just use the explorer context menu and select Git Clone….
このセクションでは、既存のリポジトリから git リポジトリのクローンを作成する方法について説明します。この操作は、リモート リポジトリの完全なコピーを取得するために使用されます。 git リポジトリのクローン作成は非常に簡単です。空のディレクトリで、エクスプローラーのコンテキスト メニューを使用して、[Git Clone…] を選択するだけです。
URL: Input repository URL address, which you will clone from. You can click Browse to browse directory.
クローンを作成するリポジトリ URL アドレスを入力します。 「参照」をクリックしてディレクトリを参照できます。
Directory: Input your local directory, which you will clone to. You can click Browse to browse directory.
クローンを作成するローカル ディレクトリを入力します。 「参照」をクリックしてディレクトリを参照できます。
Clone Repository – TortoiseGit – Documentation – TortoiseGit – Windows Shell Interface to Git と Google 翻訳
git.exe clone --progress -v -- "リモートリポジトリの URL " "クローン作成先のフォルダパス"
上記のコマンドが実行され、成功しました。「閉じる」ボタンで閉じます。

git.exe clone --progress -v -- "G:\Dev\remotes\godot\SakuraCrowdGodotLib" "G:\Dev\Godot4GD\SakuraCrowd\tmp\SakuraCrowdGodotLib"
Cloning into 'G:\Dev\Godot4GD\SakuraCrowd\tmp\SakuraCrowdGodotLib'...
done.
warning: remote HEAD refers to nonexistent ref, unable to checkout
成功 (766 ms @ 2025/08/04 16:12:21)
–progress は、クローンの進捗状況を標準エラー出力に出力する指定です。
-v は、処理のより詳細な情報を出力します。
Clones a repository into a newly created directory, creates remote-tracking branches for each branch in the cloned repository (visible using
git
branch
--remotes
), and creates and checks out an initial branch that is forked from the cloned repository’s currently active branch.新しく作成されたディレクトリにリポジトリをクローンし、クローンされたリポジトリ内の各ブランチにリモート追跡ブランチを作成し (git Branch –remotes を使用して表示可能)、クローンされたリポジトリの現在アクティブなブランチからフォークされた最初のブランチを作成してチェックアウトします。
–progress
Progress status is reported on the standard error stream by default when it is attached to a terminal, unless –quiet is specified. This flag forces progress status even if the standard error stream is not directed to a terminal.–quiet が指定されていない限り、端末に接続すると、デフォルトで進行状況が標準エラー ストリームで報告されます。このフラグは、標準エラー ストリームが端末に向けられていない場合でも、進行状況ステータスを強制します。
-v
–verbose
Run verbosely. Does not affect the reporting of progress status to the standard error stream.冗長に実行します。標準エラー ストリームへの進行状況のレポートには影響しません。
Git – git-clone Documentation と Google 翻訳
TortoiseGit のクローン実行時のダイアログ内の「warning: warning: remote HEAD refers to nonexistent ref, unable to checkout」 については、リモートリポジトリで以下のように HEAD を設定することで解消できるかもしれません。
git remote set-head origin -a
クローン後、 remotes/origin が作成されていました
クローンの後、リモートを設定していないのに、自動的に origin という、クローン元のリモートリポジトリの URL を持つリモートが保存されました。
作業ディレクトリをエクスプローラで開いて、右クリックで表示されるメニュー「TortoiseGit」→「設定」の「Git」→「リモート」のページで、リモートのリストの origin を選択すると確認できます。

最新の状態をチェックアウト
リモートリポジトリをクローン(複製)したフォルダをエクスプローラで開くと、.git フォルダだけが作成されていました。
この .git フォルダのリポジトリから、指定したブランチの最新のリビジョンを作業ディレクトリにチェックアウトします。
クローンを作成したフォルダをエクスプローラで開いて、右クリックで表示されるメニュー「TortoiseGit」→「切り替え/チェックアウト(W)…」を選択します。

「切り替え先」枠の「ブランチ」ラジオボタンを選択して、プルダウンリストからクローン元のリモートブランチ(例ではクローン時に保存されたリモートの remotes/origin/main )を選択します。
「オプション」枠の「新しいブランチを作成」に最初からチェックが入っていて、 main という名前が指定されています。
このクローンしたローカルリポジトリでは、これを変更せずにチェックアウトして、ローカルブランチ main を作成します。
リモートリポジトリのブランチをチェックアウトの対象にしたため、「追跡」もチェックされていましたが、このローカルブランチと、リモートブランチの関連付けは行わないので、チェックを外します。
設定したら OK ボタンを押して、クローンしたリポジトリ内の指定したブランチをチェックアウトします。

The Switch/Checkout dialog can be used to checkout a specific version to the working tree (i.e., all files are updated to match their state of the selected version). Normally, a specific version will be represented by a (local) branch which is set as the current branch (cf. the section called “Branching/Tagging” and user-manual man-page).
[切り替え/チェックアウト] ダイアログを使用して、特定のバージョンを作業ツリーにチェックアウトできます (つまり、すべてのファイルが、選択したバージョンの状態と一致するように更新されます)。通常、特定のバージョンは、現在のブランチとして設定された (ローカル) ブランチによって表されます (「ブランチ/タグ付け」と呼ばれるセクションおよびユーザー マニュアルのマニュアル ページを参照)。
When you selected a remote branch, you can check Track in order to track the remote branch. When you open the push, pull or sync dialog, the remote branch will be pre-selected automatically.
リモート ブランチを選択した場合、リモート ブランチを追跡するために [追跡] をオンにできます。プッシュ、プル、または同期ダイアログを開くと、リモート ブランチが自動的に事前選択されます。
Checking Out A Working Tree (Switch to commit) – TortoiseGit – Documentation – TortoiseGit – Windows Shell Interface to Git と Google 翻訳
git.exe checkout --no-track -b main --end-of-options remotes/origin/main --
上記のチェックアウトのコマンドが実行され、成功しました。

git.exe checkout --no-track -b main --end-of-options remotes/origin/main --
Switched to a new branch 'main'
成功 (906 ms @ 2025/08/04 16:18:39)
チェックアウトにより、作業ディレクトリに指定したバージョン(リビジョン)のファイルを展開しました。
Updates files in the working tree to match the version in the index or the specified tree. If no pathspec was given,
git
checkout
will also updateHEAD
to set the specified branch as the current branch.作業ツリー内のファイルを更新して、インデックスまたは指定されたツリー内のバージョンと一致させます。 pathspec が指定されていない場合、git checkout は HEAD も更新して、指定されたブランチを現在のブランチとして設定します。
Git – git-checkout Documentation と Google 翻訳
チェックアウトで、バージョン管理しているファイル群がフォルダに展開されましたが、まだ、サブモジュールのフォルダの内部にはファイルがありません。

※このスクリーンショットはファイル追加を行う前のものです。実際はこの段階で project.godot などの前回追加したファイルも表示されています。
今回はここまで
次回は、クローン(複製)した作業ディレクトリにサブモジュールのファイルをチェックアウトします。
参照サイト Thank You!
- Git
- TortoiseGit – Windows Shell Interface to Git
- GitHub
- Git – サーバー用の Git の取得
- Clone Repository – TortoiseGit – Documentation – TortoiseGit – Windows Shell Interface to Git
- Checking Out A Working Tree (Switch to commit) – TortoiseGit – Documentation – TortoiseGit – Windows Shell Interface to Git
- Submodules – TortoiseGit – Documentation – TortoiseGit – Windows Shell Interface to Git
- Git – git-clone Documentation
- Git – git-checkout Documentation
- Git – git-submodule Documentation
記事一覧 → Compota-Soft-Press
コメント