关于 git 本地创建 SSH Key 遇到的一点问题(①file to save the key & ②the authenticity of host...)

背景

由于想测试一下 SSH Key 创建的路径(.ssh 目录路径)对于不同位置 git 项目是否有效。

比如,.ssh 默认在 C:\[users]\[username] 目录下,而项目 project 在 D:\ 目录。测试结果是依然有效,即 .ssh 在 C:\[users]\[username] 目录下时,在其他位置 push 时无需进行密码认证(测试时项目以 SSH clone)。

PS:测试前已经将远程仓库托管平台公钥配置好。

事件1(file to save the key)

在本地创建 SSH Key 过程中:

$ ssh-keygen -t rsa -C"[email protected]"

Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/[usrname]/.ssh/id_rsa):

当在后面输入其它路径时发现不能键入.ssh,唯独默认路径中可包含 .ssh。不过只要路径中不包括 .xxx 即可生成  SSH Key。

事件2(the authenticity of host...)

首次 clone(SSH)时报错

The authenticity of host 'gitee.com (xxx.xxx.xxx.xxx)' can't be established.
ECDSA key fingerprint is xxxxxxxxxxxxxxxxxxx.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'gitee.com,xxx.xxx.xxx.xxx' (ECDSA) to the list of known hosts.
Bad packet length 2650498063.
ssh_dispatch_run_fatal: Connection to xxx.xxx.xxx.xxx port 22: message authentication code incorrect
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

不过后来就好了,也没找出原因。

猜你喜欢

转载自www.cnblogs.com/xunzhiyou/p/10568892.html