Git4 択難易度 基礎

リモートにあるリポジトリを手元に複製するコマンドは?

正答

  1. git init https://example.com/app.git
  2. git pull https://example.com/app.git
  3. git fetch https://example.com/app.git
  4. git clone https://example.com/app.git

解説

git clone は履歴を含むリポジトリ全体をコピーし、複製元を origin という名前のリモートとして登録する。git init は空のリポジトリを新規作成するコマンドで、URL を渡しても複製にはならない。git pull や git fetch は既にリポジトリがある場所でリモートの更新を取り込むもので、何も無いディレクトリでは not a git repository になる。

参考: git-scm.com

cloneremote

この問題を含む Git のテストを制限時間つきで解く

Gitクイズへ