Edited at

新規に立てたgithubリポジトリからソースをcloneする

More than 5 years have passed since last update.

ターミナルからcloneを実行


s git clone git@github.com:otajisan/work.git
Initialized empty Git repository in /home/mtaji/work/.git/
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

エラーが発生。

permissionで弾かれている。

RSA公開鍵を作成


s ssh-keygen -C mtaji@taji.dev02
Generating public/private rsa key pair.
Enter file in which to save the key (/home/mtaji/.ssh/id_rsa): id_rsa
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in id_rsa.
Your public key has been saved in id_rsa.pub.
The key fingerprint is:
・・・

生成確認


s ls -l
合計 12
-rw------- 1 mtaji mtaji 1743 3月 24 11:57 2013 id_rsa
-rw-r--r-- 1 mtaji mtaji 398 3月 24 11:57 2013 id_rsa.pub
-rw-r--r-- 1 mtaji mtaji 803 3月 24 11:42 2013 known_hosts

公開鍵を確認


s cat id_rsa.pub

この内容を、githubの「SSH Keys」に登録すればいけるはず。

というわけで、再度clone実行。


s git clone git@github.com:otajisan/work.git
Initialized empty Git repository in /home/mtaji/work/.git/
Warning: Permanently added the RSA host key for IP address '192.30.252.130' to the list of known hosts.
Enter passphrase for key '/home/mtaji/.ssh/id_rsa':
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (3/3), done.

キター


s cd work
s ls -l
合計 4
-rw-rw-r-- 1 mtaji mtaji 60 3月 24 12:05 2013 README.md

正常にcloneできている。

これで、githubを使って自宅での開発も可能そうです。