新規プロジェクト作成時のGit/GitHubの操作を解説します。
.gitファイルがない場合は、以下のコマンドを実行します。
git init
以下のコマンドを実行し、変更をステージに追加します。
git add -A
![](https://ootkblog.com/wp-content/uploads/2024/04/project-start-git-github-1.png)
以下のコマンドを実行し、変更をステージに追加します。
git commit -m "first commit"
![](https://ootkblog.com/wp-content/uploads/2024/04/project-start-git-github-2.png)
GitHubでリモートリポジトリを作成します。GitHubでリモートリポジトリを作成する方法は以下の記事を参照してください。
東京に住むIT系会社員のBLOG
![](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==)
![](https://ootkblog.com/wp-content/uploads/2024/03/github-create-repository-3.png)
GitHubでリモートリポジトリを作成する方法 | 東京に住むIT系会社員のBLOG
GitHubでリモートリポジトリを作成する方法を解説します。 まず「Your repositories」に移動します。 「New」をクリックします。 「Repository name」を入力して、「Create…
リモートリポジトリ(GitHub)のurlをコピーします。
![](https://ootkblog.com/wp-content/uploads/2024/04/project-start-git-github-3-1024x349.png)
以下のコマンドを実行し、リモートリポジトリ(GitHub)とリモート名を関連付けます。
git remote add リモート名 リモートリポジトリurl
![](https://ootkblog.com/wp-content/uploads/2024/04/project-start-git-github-4.png)
以下のコマンドを実行し、ローカルリポジトリの変更内容をリモートリポジトリ(GitHub)にプッシュします。
git push -u リモート名 ブランチ名
![](https://ootkblog.com/wp-content/uploads/2024/04/project-start-git-github-5.png)
ローカルリポジトリの変更内容をリモートリポジトリ(GitHub)にプッシュできました。
![](https://ootkblog.com/wp-content/uploads/2024/04/project-start-git-github-6-1024x575.png)
これで新規プロジェクト作成時のGit/GitHubの操作完了です。