« GitHub で、アプリケーションを公開 No.1 | メイン | GitHub で、アプリケーションを公開 No.3 »

Git

GitHub で、アプリケーションを公開 No.2

GitHub には ssh を使って接続するので、ローカル クライアントで 鍵を生成し、公開鍵を GitHub に登録。

●秘密鍵・公開鍵の生成
$ ssh-keygen -t rsa -C mymail@domain
Generating public/private rsa key pair.
Enter file in which to save the key (/home/taro/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 	← なし
Enter same passphrase again:  		← なし
Your identification has been saved in /home/taro/.ssh/id_rsa.
Your public key has been saved in /home/taro/.ssh/id_rsa.pub.
The key fingerprint is:
99:ca:ce:03:cb:4c:74:99:10:4b:fd:33:be:24:c8:99 mymail@domain
The key's randomart image is:
+--[ RSA 2048]----+
|        .   . o. |
|       o . . *  E|
|      +   o * o  |
|     . o o + o   |
|      = S o      |
|     + * o .     |
|      = . .      |
|       .         |
|                 |
+-----------------+
$ ll ~/.ssh
total 16
-rw-r--r--. 1 taro apache  162 Jul  4 08:53 config
-rw-------  1 taro apache 1675 Jul  3 18:39 id_rsa
-rw-r-----  1 taro apache  404 Jul  3 18:39 id_rsa.pub
-rw-r--r--. 1 taro apache 2823 Jul  4 08:46 known_hosts
●登録する公開鍵文字列
[taro@fitPC2i ~]$ cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAuGuYZe/fw9yuyTZSYqCLKjKGeacAcE5cdSjZg4bdtA9ikPuadyxfvGs/UfJiUye8uTfXufOdF1llBRZSQlMkNNPq+1eet6yigYFuijc/MZ1OsZYPs0fcE9rV7BYYmhpnK89hCmEzs1sd3msM8sh837NhAGkYhwA5pXZaZlOBfcmF7Io12Eeo9tLC+TzrMkLMN6TVAwVPSXI+41qkfTx5/aYc7CLwIUcNubuk5tIh0lpK/6kBAIHD5wWFRWaFAWzc0fMfXk/WTTiPYSKpP4pNHdVS5n1+i/u8HaEVSLdRBQhXEqFDwnD4duHx+wpCNFkQAW68IaJf3ebFN3Ia+muivQ== mymail@domain
●自分の github.com/remixgrjp に公開鍵を登録
Account settings(マイページ右上)
https://github.com/settings/profile

SSH Keys

Add SSH Key
key へ公開鍵文字列をコピーして「Add key」

●登録された公開鍵の確認URL...▼
https://github.com/remixgrjp.keys
[taro@fitPC2i ~]$ ssh git@github.com
The authenticity of host 'github.com (204.232.175.90)' can't be established.
RSA key fingerprint is 99:ca:ce:03:cb:4c:74:99:10:4b:fd:33:be:24:c8:99.
Are you sure you want to continue connecting (yes/no)yes    
Warning: Permanently added 'github.com,204.232.175.90' (RSA) to the list of known hosts.
PTY allocation request failed on channel 0
Hi remixgrjp! You've successfully authenticated, but GitHub does not provide shell access.
          Connection to github.com closed.
remixgrjp が認識されている。

●問題の切り分け方法
[taro@fitPC2i ~]$ ssh -T git@github.com
[taro@fitPC2i ~]$ ssh -vT git@github.com
●既に別の公開鍵がある場合など、~/.ssh/config を設定する場合の例。
[taro@fitPC2i ~]$ ssh-keygen -t rsa -C github.com@remix.asia -f $HOME/.ssh/github

[taro@fitPC2i ~]$ cat ~/.ssh/config
Host *
	ServerAliveInterval 120
Host github
	HostName github.com
	Port 22
	User git
	IdentityFile ~/.ssh/github
●試しに git のソースをローカルにクローン。
[taro@fitPC2i ~]$ mkdir ~/git
[taro@fitPC2i ~]$ cd ~/git
[taro@fitPC2i git]$ git clone git://git.kernel.org/pub/scm/git/git.git .
Initialized empty Git repository in /home/taro/git/.git/
remote: Counting objects: 157912, done.
remote: Compressing objects: 100% (41352/41352), done.
remote: Total 157912 (delta 116119), reused 156243 (delta 114603)
Receiving objects: 100% (157912/157912), 37.55 MiB | 565 KiB/s, done.
Resolving deltas: 100% (116119/116119), done.
●試しに フレームワーク ethna のソースをローカルにクローン。
[taro@fitPC2i ~]$ mkdir ~/ethna
[taro@fitPC2i ethna]$ cd ~/ethna
[taro@fitPC2i ethna]$ git clone ssh://git@ssh.github.com:443/ethna/ethna.git .
Initialized empty Git repository in /home/taro/ethna/.git/
The authenticity of host '[ssh.github.com]:443 ([204.232.175.73]:443)' can't be established.
RSA key fingerprint is 99:ca:ce:03:cb:4c:74:99:10:4b:fd:33:be:24:c8:99.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[ssh.github.com]:443,[204.232.175.73]:443' (RSA) to the list of known hosts.
remote: Counting objects: 8208, done.
remote: Compressing objects: 100% (3701/3701), done.
remote: Total 8208 (delta 4657), reused 7907 (delta 4425)
Receiving objects: 100% (8208/8208), 5.73 MiB | 550 KiB/s, done.
Resolving deltas: 100% (4657/4657), done.
続く

トラックバック

このエントリーのトラックバックURL:
https://www.remix.asia/cgi/mt/mt-tb.cgi/7016

コメントを投稿

(いままで、ここでコメントしたことがないときは、コメントを表示する前にこのブログのオーナーの承認が必要になることがあります。承認されるまではコメントは表示されません。そのときはしばらく待ってください。)