

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# ステップ 2: GitHub リポジトリを作成します。
<a name="tutorials-github-create-github-repository"></a>

リビジョンを保存するには、GitHub リポジトリが必要です。

すでに GitHub リポジトリがある場合は、このチュートリアル全体で **CodeDeployGitHubDemo** の名前を必ず置き換えて、「[ステップ 3: GitHub リポジトリにサンプルアプリケーションをアップロードします。](tutorials-github-upload-sample-revision.md)」に進んでください。

1. [GitHub home page](https://github.com/dashboard) で、次のいずれかの操作を実行します。
   + [**Your repositories**] で、[**New repository**] を選択します。
   + ナビゲーションバーで、[**Create new** (**\$1**)] を選択し、[**New repository**] を選択します。

1. [**Create a new repository**] ページで、次の操作を実行します。
   + [**リポジトリ名**] ボックスに「**CodeDeployGitHubDemo**」と入力します。
   + [**Public**] を選択します。
**注記**  
デフォルトの [**Public**] オプションを選択すると、誰でもこのリポジトリを表示できます。[**プライベート**] オプションを選択して、リポジトリを表示してコミットできるユーザーを制限できます。
   + [**Initialize this repository with a README**] チェックボックスをオフにします。代わりに、次のステップでは、`README.md` ファイルを手動で作成します。
   + [**Create repository (リポジトリの作成)**] を選択します。

1. ローカルマシンタイプ別の手順に従い、コマンドラインを使用してリポジトリを作成します。
**注記**  
GitHub で 2 要素認証を有効にした場合、パスワードの入力を求められたら、GitHub のログインパスワードの代わりに必ず個人アクセストークンを入力するようにしてください。詳細については、[Providing your 2FA authentication code](https://help.github.com/articles/providing-your-2fa-authentication-code/) を参照してください。

**ローカル Linux、macOS、Unix マシンについて**

1. ターミナルから、次のコマンドを一度に 1 つずつ実行します。*user-name* は GitHub のユーザー名です。

   ```
   mkdir /tmp/CodeDeployGitHubDemo
   ```

   ```
   cd /tmp/CodeDeployGitHubDemo
   ```

   ```
   touch README.md
   ```

   ```
   git init
   ```

   ```
   git add README.md
   ```

   ```
   git commit -m "My first commit"
   ```

   ```
   git remote add origin https://github.com/user-name/CodeDeployGitHubDemo.git
   ```

   ```
   git push -u origin master
   ```

1. ターミナルを `/tmp/CodeDeployGitHubDemo` の場所で開いたままにします。

**ローカル Windows マシンの場合**

1. 管理者として実行するコマンドプロンプトから、次のコマンドを一度に 1 つずつ実行します。

   ```
   mkdir c:\temp\CodeDeployGitHubDemo
   ```

   ```
   cd c:\temp\CodeDeployGitHubDemo
   ```

   ```
   notepad README.md
   ```

1. Notepad に `README.md` ファイルを保存します。Notepad を閉じます。次のコマンドを一度に 1 つずつ実行します。*user-name* は GitHub のユーザー名です。

   ```
   git init
   ```

   ```
   git add README.md
   ```

   ```
   git commit -m "My first commit"
   ```

   ```
   git remote add origin https://github.com/user-name/CodeDeployGitHubDemo.git
   ```

   ```
   git push -u origin master
   ```

1. コマンドプロンプトを `c:\temp\CodeDeployGitHubDemo` の場所で開いたままにします。