Generating public/private ed25519 key pair. Enter file in which to save the key (/c/Users/YOU/.ssh/id_ed25519): Created directory '/c/Users/YOU/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again:
**Gitee:**点击导航栏右上角头像,选择「设置」,然后在侧边栏菜单选择「SSH 公钥」,填入上一步保存的公钥内容并保存确认。 **GitHub:**点击导航栏右上角头像,选择「Settings」,然后在侧边栏菜单选择「SSH and GPG keys」,填入上一步保存的公钥内容并保存确认。
7.测试连接
1
ssh -T git@github.com
输入后显示:
1 2 3 4
The authenticity of host 'github.com (ip)' can't be established. ED25519 key fingerprint is SHA256:****. This key is not known by any other names. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
输入yes后显示:
1 2
Warning: Permanently added 'github.com' (ED25519) to the list of known hosts. Hi 用户名! You've successfully authenticated, but GitHub does not provide shell access.
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead. remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information. fatal: Authentication failed for 'https://github.com/xxx/xxx.git/'
$ ssh-keygen -p Enter file in which the key is (/c/Users/asua/.ssh/id_rsa): # 如果你的密钥就在默认位置,直接回车就行,如果不是,就手动输入 Key has comment 'hahaha@gmail.com' # 之前生成密钥时,我输入的内容 Enter new passphrase (empty for no passphrase): # 输入新密码 Enter same passphrase again: # 再次输入密码 Your identification has been saved with the new passphrase. # 身份信息和密码一起保存
> Initializing new SSH agent... > succeeded > Enter passphrase for /c/Users/you/.ssh/id_rsa: > Identity added: /c/Users/you/.ssh/id_rsa (/c/Users/you/.ssh/id_rsa) > Welcome to Git (version 1.6.0.2-preview20080923) > > Run 'git help git' to display the help index. > Run 'git help ' to display help for specific commands.