Last active
December 11, 2015 12:28
-
-
Save tsubakimoto/4600931 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Github.com のアカウントを作成し、ログインする。 | |
# Github用の公開鍵、秘密鍵を生成する。 | |
$ ssh-keygen | |
Generating public/private rsa key pair. | |
Enter file in which to save the key (/home/matsumura/.ssh/id_rsa): | |
Created directory '/home/matsumura/.ssh'. | |
Enter passphrase (empty for no passphrase): | |
Enter same passphrase again: | |
Your identification has been saved in /home/matsumura/.ssh/id_rsa. | |
Your public key has been saved in /home/matsumura/.ssh/id_rsa.pub. | |
# 公開鍵と秘密鍵の名前を分かりやすいものに変更する。 | |
$ mv ~/.ssh/id_rsa ~/.ssh/github_id_rsa | |
$ mv ~/.ssh/id_rsa.pub ~/.ssh/github_id_rsa.pub | |
$ chmod 600 ~/.ssh/github* | |
# Github用の公開鍵を使用する準備をする(サーバへのSSH接続の鍵と分けるため)。 | |
$ vi ~/.ssh/config | |
Host github.com | |
User git | |
Hostname github.com | |
PreferredAuthentications publickey | |
IdentityFile ~/.ssh/github_id_rsa | |
# configファイルの権限を変更する。 | |
$ chmod 600 ~/.ssh/config | |
# 生成した公開鍵の中身をコピーする。 | |
$ cat ~/.ssh/github_id_rsa.pub | |
# Githubのアカウントに公開鍵を登録する。 | |
https://github.com/ | |
[Account settings] -> [SSH Keys] -> [Add SSH Key] | |
# 接続できるかを確認する。 | |
$ ssh git@github.com | |
The authenticity of host 'github.com (207.97.227.239)' can't be established. | |
RSA key fingerprint is (...鍵情報...). | |
Are you sure you want to continue connecting (yes/no)? yes | |
Warning: Permanently added 'github.com,207.97.227.239' (RSA) to the list of known hosts. | |
PTY allocation request failed on channel 0 | |
Hi tsubakimoto! You've successfully authenticated, but GitHub does not provide shell access. | |
Connection to github.com closed. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment