ythy / blog

Give everything a shot
6 stars 0 forks source link

git SHH 设置记录 #455

Open ythy opened 2 years ago

ythy commented 2 years ago

$  ssh-keygen -t ed25519 -C "ythyhvh@163.com"
Generating public/private ed25519 key pair.
Enter file in which to save the key (/c/Users/imc/.ssh/id_ed25519):
Created directory '/c/Users/imc/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/imc/.ssh/id_ed25519.
Your public key has been saved in /c/Users/imc/.ssh/id_ed25519.pub.
The key fingerprint is:
SHA256:LkZEPLlGMdgKm2IEwUjvbIFhkhHYNR4qWXJ81icR+Xc ythyhvh@163.com
The key's randomart image is:
+--[ED25519 256]--+
|&@o.+=**         |
|*BBo++X..        |
|+..O.o.*         |
|.o= o.o . . E    |
|.. + .. S. .     |
|  .  . .         |
|      o .        |
|     . .         |
|                 |
+----[SHA256]-----+

$ eval "$(ssh-agent -s)"
Agent pid 1875

$ ssh-add ~/.ssh/id_ed25519
Identity added: /c/Users/imc/.ssh/id_ed25519 (ythyhvh@163.com)

$ ssh-add -l
# Lists ssh keys

clip < ~/.ssh/id_ed25519.pub

$ ls -al ~/.ssh
# Lists the files in your .ssh directory, if they exist

~/.ssh/config 设置,否则报22端口错误

Host github.com
User git
Hostname ssh.github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_ed25519
Port 443
ythy commented 2 years ago

$后面的设置是在 git bash 窗口下进行的