LoginSignup
89
89

More than 5 years have passed since last update.

Githubに新規リポジトリ(Repository)を作成する

Last updated at Posted at 2016-02-03

前提
GitHubのアカウント作成済み
sshKeyを登録済み
hogitがインストール済み

環境
Mac OS X El Capitan(ver.10.11.1)

1. GitHubで新しいリポジトリを作成

  • Repository name:必須。リポジトリ名を入力
  • Description:任意。リポジトリの説明を入力
  • Public/Private:公開したくない場合はPrivate(有償契約の場合)
  • Initialize this repository with a README:READMEを作成するか否か。後から作れるため未チェック。
  • Add .gitignore:git で無視するファイルを指定するファイル。後から作れるためNone
  • Add a license:ライセンス設定。後から作れるためNone

2. 既存のローカルリポジトリをGitリポジトリに変換する

cd [GitHubで管理したいローカルのリポジトリ]
git init
example
cd /work/rocal/repository
git init

3. ローカルリポジトリのファイルをインデックスに追加、コミットする

git add .
git commit -m "[コミットのコメント]"
example
git add .
git commit -m "FirstCommit"

4. GitHubのリモートリポジトリ情報を追加する

git remote add origin [リモートリポジトリ情報]
example
git remote add origin https://github.com/xxxx/sample-repository.git

5. ローカルリポジトリをリモートリポジトリへ反映させる

git push origin master

Appendix

他にGithubで新しいリポジトリを作って利用する方法としては、Githubで新規リポジトリ作成して、ローカルリポジトリとしてCloneする方法もある。

89
89
0

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
89
89