3
4

More than 5 years have passed since last update.

GitHubのリポジトリの始め方

Last updated at Posted at 2019-06-14

*** 備忘録です。間違い等があればご指摘ください。 ***

前提

ローカルホストにリポジトリ用のファイルが「まだない」場合

  1. https://github.com/にSign inする。
  2. 右上の「+」から「New repository」を選択する。
  3. 「Repository name」にリポジトリ名を入力する。
  4. リポジトリを公開する場合は「Public」、公開しない場合は「Private」をチェックする。
  5. 「Initialize this repository with a README」をチェックする。
  6. 「Create repository」をクリックする。
  7. リモートリポジトリをローカルホストにコピーする。

    $ cd ~/GitHub  <-- 各自のGitHubのリポジトリを保存しておくディレクトリ
    $ git clone https://github.com/ユーザー名/リポジトリ名.git
    
  8. ローカルホストでファイルの修正や追加を行ったら、リモートリポジトリを更新する。

    $ git add ファイル名
    $ git commit -m "コメント"
    $ git push
    

ローカルホストにリポジトリ用のファイルが「既にある」場合

  1. https://github.com/にSign inする。
  2. 右上の「+」から「New repository」を選択する。
  3. 「Repository name」にリポジトリ名を入力する。
  4. リポジトリを公開する場合は「Public」、公開しない場合は「Private」をチェックする。
  5. 「Initialize this repository with a README」をチェックしない。
  6. 「Add .gitignore: None」および「Add a license: None」選択する。
  7. 「Create repository」をクリックする。
  8. ローカルホストのリポジトリを初期化する。

    $ 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
    
  10. ローカルホストでファイルの修正や追加を行ったら、リモートリポジトリを更新する。

    $ git add ファイル名
    $ git commit -m "コメント"
    $ git push
    
3
4
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
4