2021年2月27日土曜日

github clone ssh

githubからidとpasswordでgit cloneしたらgithubから怒られました。

2021年8月頃にidとpasswordでは、操作できなくなるそうです。(詳細)

少しハマったのでキーの作成方法と公開キーの登録方法をメモしておきます。

sshキーの作り方

$ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

キーをgithubへ登録する方法

catで表示してコビーペーストでも問題ない。


1.

2. 左端のメニューの"SSH and GPG keys"

3. 右上の"New SSH key"

sshの接続テスト

$ ssh -T git@github.com

The authenticity of host 'github.com (52.192.72.89)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes   <== 入力
Warning: Permanently added 'github.com,52.192.72.89' (RSA) to the list of known hosts.
Hi user-ID! You've successfully authenticated, but GitHub does not provide shell access.
または
Hi user-ID! You've successfully authenticated, but GitHub does not provide shell access.
のように表示されたらOK 

cloneの例

$ git clone git@github.com:abcd/efghi.git

0 件のコメント:

コメントを投稿