1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

GitHub再入門(リポジトリ作成)

Last updated at Posted at 2018-04-15

リポジトリ作成

以下の2通り。

1. GitHubに自分オリジナルの新規リポジトリを作成する

0.png

2. 既存GitHubリポジトリをベースに新規リポジトリを作成する

fork.png

1. GitHubに自分オリジナルの新規リポジトリを作成する

以下の流れでGitHubに自分オリジナルの新規リポジトリを作成する。

0.png

cmd
mkdir TestRepository
cd TestRepository
git init
echo "# TestRepository" >> README.md
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/<ユーザ名>/TestRepository.git
git push origin master

1-1. GitHubリポジトリ(リモートリポジトリ)を作成

GitHubにログインし、New repositoryでリポジトリ名を入力して作成する(このケースではこの時点でREADME、.gitignore、Licenseは追加しない)。

1.png

1-2.png

1-2. 作成したGitHubリポジトリに対するローカルリポジトリを作成(init

cmd
$ mkdir TestRepository
$ cd TestRepository
$ git init
$ ls -la

2.png

1-3. ローカルリポジトリのインデックスにファイルを登録する(add

cmd
echo "# TestRepository" >> README.md
ls -la
git status
git add README.md
git status

3.png

1-4. ローカルリポジトリに対してファイルの更新を確定する(commit

cmd
git commit -m "first commit"
git status

4.png

1-5. リモートリポジトリに対してローカルリポジトリの確定を反映する(push

cmd
git remote
git remote add origin https://github.com/<ユーザ名>/TestRepository.git
git remote
git push origin master

5.png

5-2.png

2. 既存GitHubリポジトリをベースに新規リポジトリを作成する

以下の流れで既存GitHubリポジトリをベースに新規リポジトリを作成する。

fork.png

2-1. 既存のGitHubリポジトリをベースに新規のGitHubリポジトリを作成(fork

ベースにしたい既存のGitHubリポジトリのページのForkボタンを押下する。

1.png

1-2.png

1-3.png

2-2. GitHubリポジトリからローカルリポジトリを作成(clone

先ほど作成した新規のGitHubリポジトリページでClone URLを確認する。

2.png

git cloneコマンドの引数にClone URLを指定して実行する。

cmd
git clone https://github.com/ghtomo/TestRepository.git
ls -la TestRepository

2-1.png

1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?