接続手順
1. 公開鍵の設定
1-1 . 自分の公開鍵が存在するか確認 (あれば作成手順はスキップ)
ls ~/.ssh/id_rsa.pub
1-2 .公開鍵の作成
cd ~/
ssh-keygen -t rsa -b 4096 -C "xxx@xxx.jp"
「Enter file in which to save the key」と聞かれたら、基本はEnter(= ~/.ssh/id_rsa に保存)
こういうファイルできる
/c/Users/[ユーザ名]/.ssh/id_rsa.pub
1-3. 登録ページに移動
https://github.com/settings/ssh/new
GitHub右上のアイコン → Settings
左サイドバーから SSH and GPG keys
「Add SSH key」ボタン
以下を入力
タイトル : 任意
Key: コピーした公開鍵を入力(id_rsa.pub接続確認(git bash)
ssh -T git@github.com
こういう形で出力される
The authenticity of host 'github.com (20.27.177.113)' can't be established.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'github.com' (ED25519) to the list of known hosts.
Hi xxxxxx! You've successfully authenticated, but GitHub does not provide shell access.
git でリモート接続
git remote add origin git@github.com:xxxxx/xxxxx.git