Ren*_*gen 100 windows git ssh putty plink
我尝试将更改从我的本地仓库推送到远程仓库.当我输入:
git push origin
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx
Connection abandoned.
fatal: The remote end hung up unexpectedly
Run Code Online (Sandbox Code Playgroud)
我怎么解决这个问题?我在Windows 7中使用命令行中的git.
编辑
当我尝试做一个简单的ssh
ssh user@hostname
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
Could not create directory '/c//%HOMEDRIVE%%HOMEPATH%/.ssh'.
percent_expand: unknown key %H
Run Code Online (Sandbox Code Playgroud)
不知何故,它不会创建目录,因为路径无效.如何解决这个问题?
@eckes:Edit2
我的家设置%HOMEDRIVE%%HOMEPATH%为这是正确的吗?
Rom*_*kov 154
对于那些通过标准命令提示符在Windows上使用PuTTY设置MSYS Git的人来说,将主机添加到PuTTY缓存的方法是运行
> plink.exe <host>
Run Code Online (Sandbox Code Playgroud)
例如:
> plink.exe codebasehq.com
The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 2048 2e:db:b6:22:f7:bd:48:f6:da:72:bf:59:d7:75:d7:4e
If you trust this host, enter "y" to add the key to
PuTTY's cache and carry on connecting.
If you want to carry on connecting just once, without
adding the key to the cache, enter "n".
If you do not trust this host, press Return to abandon the
connection.
Store key in cache? (y/n)
Run Code Online (Sandbox Code Playgroud)
只需回答y,然后按Ctrl + C休息.
尽管检查指纹.这个警告是有充分理由的.一些git服务的指纹(请编辑添加更多):
16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:4897:8c:1b:f2:6f:14:6b:5c:3b:ec:aa:46:46:74:7c:407e:af:8d:ec:f0:39:5e:ba:52:16:ce:19:fa:d4:b8:7d小智 78
尝试从Git Bash提示符执行"set | grep -i ssh"
如果你的设置与我的一样,你可能有以下设置:
GIT_SSH='C:\Program Files (x86)\PuTTY\plink.exe'
PLINK_PROTOCOL=ssh
SVN_SSH='"C:\\Program Files (x86)\\PuTTY\\plink.exe"'
Run Code Online (Sandbox Code Playgroud)
我做了一个
unset GIT_SSH
unset PLINK_PROTOCOL
unset GIT_SVN
Run Code Online (Sandbox Code Playgroud)
之后它就起作用了..我猜putty将其键保存在其他地方作为$ HOME/.ssh或其他东西......(我在$ HOME设置为"C:\ Users \"的盒子上也遇到了问题usrnam"而不是"/ C/Users/usrnam /"
无论如何,你的里程可能会有所不同,但这对我来说是固定的.:-)
(可能只是做了未设置的GIT_SSH就足够了,但我还在滚动)
注意:如果未设置对您不起作用,请尝试以下操作:
set GIT_SSH=
Run Code Online (Sandbox Code Playgroud)
eck*_*kes 53
该消息表示主机密钥origin不存在于您的可信主机文件中.
要解决此问题,请打开一个普通的SSH连接origin,SSH将询问您是否要信任远程主机(来自Git控制台):
$ ssh 127.0.0.1
The authenticity of host '127.0.0.1 (127.0.0.1)' can't be established.
RSA key fingerprint is <FINGERPRINT>.
Are you sure you want to continue connecting (yes/no)?
Run Code Online (Sandbox Code Playgroud)
如果您信任远程主机(即类型yes),SSH会将其密钥添加到已知主机列表中.
在那之后,你应该能够做到git push origin.
作为替代方案,你也可以手动添加的关键origin来.ssh/known_hosts,但是这需要你坚持的格式known_hosts文件中的手册页中所述sshd(第AUTHORIZED_KEYS文件格式).
小智 19
我怀疑你的GIT_SSH环境变量设置为%ProgramFiles(x86)%\putty\plink.exe.出于某种原因,PLink不会使用.ssh/known_hosts用户目录中的文件来存储远程主机密钥.
如果这实际上是你的情况,如果你想使用选美,它可能是故意的,你需要首先使用PLink连接到主机.
"$GIT_SSH" user@hostname
Run Code Online (Sandbox Code Playgroud)
你应该收到类似的消息
The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 2048 86:7b:1b:12:85:35:8a:b7:98:b6:d2:97:5e:96:58:1d
If you trust this host, enter "y" to add the key to
PuTTY's cache and carry on connecting.
If you want to carry on connecting just once, without
adding the key to the cache, enter "n".
If you do not trust this host, press Return to abandon the
connection.
Store key in cache? (y/n)
Run Code Online (Sandbox Code Playgroud)
一旦您回答y了问题并成功连接到远程主机,就应该全部设置好.继续尝试再次尝试.