AKAI TSUKI

System development or Technical something

Setting to connect to GitHub

接続設定前

とりあえず、接続を試みてみた結果。

$ git clone <SSHで接続する際のリポジトリのパス>
Cloning into 'board'...
The authenticity of host 'github.com (<IPアドレス>)' can't be established.
RSA key fingerprint is <fingerprintの値>.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,<IPアドレス>' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

という感じで失敗。

接続用の認証設定

認証用のキーを作成します。

$ ssh-keygen -t rsa -C "<メールアドレス>"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/<名前>/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/<名前>/.ssh/id_rsa.
Your public key has been saved in /c/Users/<名前>/.ssh/id_rsa.pub.
The key fingerprint is: <fingerprintの値> <メールアドレス>

ここで生成された公開鍵をGitHubの画面から登録します。
登録できたら、接続できることを確認します。

$ ssh -T git@github.com
Enter passphrase for key '/c/Users/<名前>/.ssh/id_rsa':
Hi <GitHubアカウント>! You've successfully authenticated, but GitHub does not provide shell access.

無事アクセスできました。

$ git clone <SSHで接続する際のリポジトリのパス>
Cloning into 'board'...
Enter passphrase for key '/c/Users/<名前>/.ssh/id_rsa':
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 5 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (5/5), 4.21 KiB | 0 bytes/s, done.
Checking connectivity... done

$ ls board/
LICENSE  README.md