简体   繁体   English

Sublime Git推送主机密钥验证失败

[英]Sublime Git pushing host key verification failed

So basically I pushed my project to gitlab by sublimegit. 所以基本上我通过sublimegit将我的项目推送到gitlab。

Now I made a format to my windows7 and installed windows10, I placed the project folder in the same path as I used to have on old OS. 现在我为我的windows7制作了一个格式并安装了windows10,我将项目文件夹放在与旧操作系统上相同的路径上。

I have the privatekey from which I can generate id_rsa - I checked it and it also generates the same public key to gitlab. 我有id_rsa ,我可以从中生成id_rsa - 我检查了它,它也生成了与gitlab相同的公钥。

I placed id_rsa to Users/Me/.ssh folder and to Program files/Git/etc/ssh and also created a folder in Git called .ssh and place it in there also. 我将id_rsa放到了Users/Me/.ssh文件夹和Program files/Git/etc/ssh ,还在Git中创建了一个名为.ssh的文件夹,并将其放在那里。

Pushing to git@gitlab.placeholder.ee:HTML/stuff.git
Host key verification failed.

fatal: Could not read from remote repository.

Can anyone see what kinda mistake I'm doing? 任何人都能看到我在做什么样的错误?

You should have id_rsa (private key) and id_rsa.pub (public key) both in C:/Users/Me/.ssh 你应该在C:/Users/Me/.sshid_rsa (私钥) id_rsa.pub (公钥)

Check that then environment variable HOME is defined (to %USERPROFILE% ), which should be the case if you are calling git-cmd.bat or git-bash.bat , packaged in the latest git for Windows . 检查然后定义环境变量HOME(到%USERPROFILE% ),如果你调用git-cmd.batgit-bash.bat ,打包在最新的git for Windows中就应该这样

As mentioned by the OP , and seen in this question , you also need to add the server key in the C:/Users/Me/.ssh/known_host file. 正如OP提到的,并且在这个问题中看到 ,您还需要在C:/Users/Me/.ssh/known_host文件中添加服务器密钥。

ssh-keyscan -t rsa github.com > ~/.ssh/known_hosts

(this is what the step 5 of GitHub SSH / Generating SSH keys does: that applies also for a gitlab server) (这就是GitHub SSH / Generating SSH keys第5步 :适用于gitlab服务器)

基本上我只需要known_hosts

ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts

您可以安装两个(github.exe / git.exe)客户端,只是尝试从PATH中移出新的客户端

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM