目录
ssh-keygen 不是内部或外部命令解决办法!
Microsoft Windows [版本 6.1.7601]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。
C:Usersdphudy>ssh-keygen -t rsa -C "2921832035@qq.com"
'ssh-keygen' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
解决办法一、设置环境变量
参考:https://www.cnblogs.com/e0yu/p/8508009.html
Git安装路径 D:Program FilesGitusrin
设置完成
结果:重新执行失败,可能需要重启变量才会生效或者路径设置错误。
解决办法二、ssh.exe 根目录下执行命令
C:Usersdphudy> cd D:Program FilesGitusrin
C:Usersdphudy>D:
D:Program FilesGitusrin>ssh-keygen -t rsa -C "2921832035@qq.com";
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/dphudy/.ssh/id_rsa):
生成/添加SSH公钥
按照提示完成三次回车,即可生成 ssh key。
D:Program FilesGitusrin>ssh-keygen -t rsa -C "2921832035@qq.com";
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/dphudy/.ssh/id_rsa):
Created directory '/c/Users/dphudy/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/dphudy/.ssh/id_rsa
Your public key has been saved in /c/Users/dphudy/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:Mcook4KNWm5Sge+PUQuVv4q0bR7bvZwlwBCLEFBJHhE 2921832035@qq.com;
The key's randomart image is:
+---[RSA 3072]----+
|=+E+. |
| +.o + |
|. + = o |
|.+ + * . o |
|+ X o * S |
|.* = . o |
|o * o . . . |
| + B.= o + |
| +o* . =. |
+----[SHA256]-----+
使用文本编辑器打开将KEY添加
添加后,在终端(Terminal)中输入 ssh -T git@gitee.com
dphudy@dp071708004 MINGW64 ~
$ ssh -T git@gitee.com
The authenticity of host 'gitee.com (180.97.125.228)' can't be established.
ECDSA key fingerprint is SHA256:FQGC9Kn/eye1W8icdBgrQp+KkGYoFgbVr17bmjey0Wc.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'gitee.com,180.97.125.228' (ECDSA) to the list of known hosts.
Hi 小岳! You've successfully authenticated, but GITEE.COM does not provide shell access.
首次使用需要确认并添加主机到本机SSH可信列表。若返回 Hi XXX! You've successfully authenticated, but Gitee.com does not provide shell access. 内容,则证明添加成功。
参考帮助中心:https://gitee.com/help/articles/4181#article-header0