*** 備忘録です。間違い等があればご指摘ください。 ***
前提
- GitHubのSign up(ユーザー登録)は終了している。
- SSH公開鍵の作成とGitHubへの登録は終了している。
ローカルホストにリポジトリ用のファイルが「まだない」場合
-
https://github.com/にSign inする。
-
右上の「+」から「New repository」を選択する。
-
「Repository name」にリポジトリ名を入力する。
-
リポジトリを公開する場合は「Public」、公開しない場合は「Private」をチェックする。
-
「Initialize this repository with a README」をチェックする。
-
「Create repository」をクリックする。
-
リモートリポジトリをローカルホストにコピーする。
$ cd ~/GitHub <-- 各自のGitHubのリポジトリを保存しておくディレクトリ
$ git clone https://github.com/ユーザー名/リポジトリ名.git
8. ローカルホストでファイルの修正や追加を行ったら、リモートリポジトリを更新する。
```
$ git add ファイル名
$ git commit -m "コメント"
$ git push
ローカルホストにリポジトリ用のファイルが「既にある」場合
-
https://github.com/にSign inする。
-
右上の「+」から「New repository」を選択する。
-
「Repository name」にリポジトリ名を入力する。
-
リポジトリを公開する場合は「Public」、公開しない場合は「Private」をチェックする。
-
「Initialize this repository with a README」をチェックしない。
-
「Add .gitignore: None」および「Add a license: None」選択する。
-
「Create repository」をクリックする。
-
ローカルホストのリポジトリを初期化する。
$ cd ~/GitHub <-- 各自のGitHubのリポジトリを保存しておくディレクトリ
$ make リポジトリ名
$ cd リポジトリ名
$ git init
9. ローカルホストでREADME.mdファイルを作成し、リモートリポジトリを更新する。
```
$ echo "# リポジトリ名" >> README.md
$ git add README.md
$ git commit -m "first commit"
$ git remote add origin https://github.com/ユーザー名/リポジトリ名.git
$ git push -u origin master
-
ローカルホストでファイルの修正や追加を行ったら、リモートリポジトリを更新する。
$ git add ファイル名
$ git commit -m "コメント"
$ git push