Pushing commits to an SSH-cloned repo via VS Code on WSL returns “Host key verification failed” - it's ok on HTTPS

主宰稳场 提交于 2020-03-21 03:02:06

问题


I'm on a Windows 10 machine and I have both Git Bash and Ubuntu for Windows Subsystem for Linux (WSL) installed. When I use GitHub's official desktop app to clone a repo via HTTPS everything works fine and I can push my commits via Visual Studio Code with no problems whatsoever. I then try to clone a repo via SSH with Hyper (WSL Bash) and get this:

The authenticity of host 'domain.com (a.b.c.d)' can't be established.
RSA key fingerprint is XX:XX:...:XX.
Are you sure you want to continue connecting (yes/no)?

After answering yes and openning that repo in VS Code and try to push my new changes to GitHub, I get this error: Git: Host key verification failed.

And this is what I get as Git Log in Output: Host key verification failed. fatal: Could not read from remote repository.

I have set up my SSH key on WSL using this method and I didn't set up any passphrase. I tried this on my brother's PC which is exactly set up like mine and it worked just fine. I would appreciate any help!

UPDATE: I typed ssh -T git@github.com in Hyper and got this as an answer: You've successfully authenticated, but GitHub does not provide shell access.

P.S. I'm a newbie in programming and stackoverflow, so please be concise and give me step by step instructions. The more you use technical terms, the more I'll probably get lost!


回答1:


Try first, for that new push, to do it in command line:

cd c:\path\to\local\repo
git status
git log
git remote -v
git push -u origin master

Make sure that:

  • git status is clean (no pending changes)
  • git log shows you at least one commit
  • git remote -v shows you as origin the URL of your remote GitHub repository
    (as an SSH URL git@github.com:<you>/<yourRepo>)

Then push, and go back to VSCode.



来源:https://stackoverflow.com/questions/60600640/pushing-commits-to-an-ssh-cloned-repo-via-vs-code-on-wsl-returns-host-key-verif

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!