ssh-keygen 不是内部或外部命令解决办法!
1Microsoft Windows [版本 6.1.7601] 2版权所有 (c) 2009 Microsoft Corporation。保留所有权利。 3 4C:\Users\dphudy>ssh-keygen -t rsa -C "2921832035@qq.com" 5'ssh-keygen' 不是内部或外部命令,也不是可运行的程序 6或批处理文件。
解决办法一、设置环境变量
参考:https://www.cnblogs.com/e0yu/p/8508009.html
Git安装路径 D:\Program Files\Git\usr\bin
设置完成
结果:重新执行失败,可能需要重启变量才会生效或者路径设置错误。

解决办法二、ssh.exe 根目录下执行命令
1C:\Users\dphudy> cd D:\Program Files\Git\usr\bin 2 3C:\Users\dphudy>D: 4 5D:\Program Files\Git\usr\bin>ssh-keygen -t rsa -C "2921832035@qq.com"; 6Generating public/private rsa key pair. 7Enter file in which to save the key (/c/Users/dphudy/.ssh/id_rsa):
生成/添加SSH公钥
按照提示完成三次回车,即可生成 ssh key。
1D:\Program Files\Git\usr\bin>ssh-keygen -t rsa -C "2921832035@qq.com"; 2Generating public/private rsa key pair. 3Enter file in which to save the key (/c/Users/dphudy/.ssh/id_rsa): 4Created directory '/c/Users/dphudy/.ssh'. 5Enter passphrase (empty for no passphrase): 6Enter same passphrase again: 7Your identification has been saved in /c/Users/dphudy/.ssh/id_rsa 8Your public key has been saved in /c/Users/dphudy/.ssh/id_rsa.pub 9The key fingerprint is: 10SHA256:Mcook4KNWm5Sge+PUQuVv4q0bR7bvZwlwBCLEFBJHhE 2921832035@qq.com; 11The key's randomart image is: 12+---[RSA 3072]----+ 13|=+E+. | 14| +.o + | 15|. + = o | 16|.+ + * . o | 17|+ X o * S | 18|.* = . o | 19|o * o . . . | 20| + B.= o + | 21| +o* . =. | 22+----[SHA256]-----+ 23
使用文本编辑器打开将KEY添加

添加后,在终端(Terminal)中输入 ssh -T git@gitee.com
1dphudy@dp071708004 MINGW64 ~ 2$ ssh -T git@gitee.com 3The authenticity of host 'gitee.com (180.97.125.228)' can't be established. 4ECDSA key fingerprint is SHA256:FQGC9Kn/eye1W8icdBgrQp+KkGYoFgbVr17bmjey0Wc. 5Are you sure you want to continue connecting (yes/no/[fingerprint])? yes 6Warning: Permanently added 'gitee.com,180.97.125.228' (ECDSA) to the list of known hosts. 7Hi 小岳! 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