LoginSignup
2
2

More than 5 years have passed since last update.

【tutorial】GitHubのリポジトリをローカルにクローン(GitBash)

Last updated at Posted at 2018-04-04

GitBash(Git For Windows)のインストールは↓の記事。
https://qiita.com/d778980/items/063e3d04fd6d2bf91abd

2018/4/4に実施。

1.GitBashを起動。↓のコマンドで秘密鍵と公開鍵を作成。

mkdir ~/.ssh
cd ~/.ssh
ssh-keygen -t rsa -C 'メールアドレス'

2.何も考えずに Enter を3回。

Generating public/private rsa key pair.
Enter file in which to save the key: →Enter1回目
Enter passphrase (empty for no passphrase): →Enter2回目
Enter same passphrase again: →Enter3回目

3.↓のコマンドで公開鍵をクリップボードにコピー。

clip < ~/.ssh/id_rsa.pub

4.GitHubにログイン。「Settings」をクリック。
1.jpg

5.「SSH and GPG keys」をクリック。
2.jpg

6.「New SSH key」をクリック。
3.jpg

7.Titleを適当に入力して、keyに「3.」でコピーした公開鍵を貼り付け。
4.jpg

8.GitBashに戻り、↓のコマンドでクローン。今回はデスクトップにクローンを作成。

cd ~/Desktop/
git clone git@github.com:Githubのユーザ:リポジトリ名.git
 例:git clone git@github.com:d778980/first.git

9.↓の質問に「yes」を入力。
Are you sure you want to continue connecting (yes/no)?

終わり。

クローンしたリポジトリにファイルを追加してコミット→プッシュする方法は次の記事。
https://qiita.com/d778980/items/6492e5b1ee70ca4a78fc

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