SSH接続設定

Githubに接続できない状態

ssh -T git@github.com

The authenticity of host 'github.com (20.xxx.xxx.xxx)' can't be established.
ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhxxxisF/zLDA0zPMSvHdxxxUvCOqU.
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.
git@github.com: Permission denied (publickey).

SSHキーペア作成

ssh-keygen -t rsa

Generating public/private rsa key pair.
Enter file in which to save the key (C:\Users\isdms/.ssh/id_rsa): ★enter
Enter passphrase (empty for no passphrase): ★enter
Enter same passphrase again: ★enter
Your identification has been saved in C:\Users\isdms/.ssh/id_rsa
Your public key has been saved in C:\Users\isdms/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:60yBg65lLPmGJI/8eSGKNK6NYClYiE7KC7vMEJZM1ZM isdms@iiyama_desktop
The key's randomart image is:
+---[RSA 3072]----+
|   .. .          |
|  .  E           |
| .    .          |
|+..  . .         |
|+=.=. o S        |
|O=o  . . o       |
|%X=.* . o        |
|@B+*o. +         |
|*=++o   o =      |
+----[SHA256]-----+

Githubで新規SSHキーを登録する(New SSH keyを押下)

.ssh ディレクトリ配下の id_rsa.pub の中身をコピーして

タイトル付けてpubキーの中身をペースト

接続できるようになる → 今後スムーズにログインするため認証情報を ~/.gitconfig に書き込む

ssh -T git@github.com
Hi isdmskz! You've successfully authenticated, but GitHub does not provide shell access.

git config --global user.name "ACCOUNT"
git config --global user.email "xxx@gmail.com"
cat ~/.gitconfig

リポジトリを作成したら・・・

ローカルに clone を作っておく

git clone git@github.com:username/repository-name.git

【WSLの場合】「:Zone.Identifier」を一括削除する

$ find ./ -type f -name '*:Zone.Identifier' -exec rm {} \;