Window设置CMD和GitBash一致
在windows下面安装了git后,没有使用 git bash
去生成key时,可能会出现以下错误
Microsoft Windows [版本 6.3.9600]
(c) 2013 Microsoft Corporation。保留所有权利。
C:\Users\Loftor>ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (//.ssh/id_rsa):
Could not create directory '//.ssh': No such file or directory
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
open //.ssh/id_rsa failed: No such host or network path.
Saving the key failed: //.ssh/id_rsa.
C:\Users\Loftor>
这个错误的原因是我们没有配置环境变量HOME
目录,从而找不到目录。
所以我们只要在环境变量中增加HOME
就能解决问题了!~
C:\Users\Loftor>ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/Loftor/.ssh/id_rsa):
Created directory '/c/Users/Loftor/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/Loftor/.ssh/id_rsa.
Your public key has been saved in /c/Users/Loftor/.ssh/id_rsa.pub.
The key fingerprint is:
04:14:6f:66:3f:f5:71:d0:d7:36:82:c6:09:94:fe:45 Loftor@LOFTOR-PC
The key's randomart image is:
+--[ RSA 2048]----+
| .+..o+ o ...|
| o . = E o=|
| B . o o.+|
| = o . o o |
| S + . . |
| o |
| |
| |
| |
+-----------------+
C:\Users\Loftor>