[英]Pushing commits to an SSH-cloned repo via VS Code on WSL returns "Host key verification failed" - it's ok on HTTPS
I'm on a Windows 10 machine and I have both Git Bash and Ubuntu for Windows Subsystem for Linux (WSL) installed. 當我使用 GitHub 的官方桌面應用程序通過 HTTPS 克隆存儲庫時,一切正常,我可以通過 Visual Studio Code 推送我的提交,沒有任何問題。 然后我嘗試通過 SSH 和 Hyper (WSL Bash) 克隆一個 repo 並得到這個:
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)?
在回答“是”並在 VS Code 中打開該存儲庫並嘗試將我的新更改推送到 GitHub 后,我收到此錯誤: Git:主機密鑰驗證失敗。
這就是我得到的 Git 登錄 Output:主機密鑰驗證失敗。 致命:無法從遠程存儲庫中讀取。
我已經使用這種方法在 WSL 上設置了我的 SSH 密鑰,但我沒有設置任何密碼。 我在我兄弟的電腦上試過這個,它的設置和我的完全一樣,效果很好。 我將不勝感激任何幫助!
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.
PS我是編程和stackoverflow的新手,所以請簡明扼要地給我一步一步的說明。 您使用技術術語的次數越多,我可能就越會迷路!
首先嘗試在命令行中執行該新推送:
cd c:\path\to\local\repo
git status
git log
git remote -v
git push -u origin master
確保:
git status
是干凈的(沒有掛起的更改)git log
至少顯示一次提交git remote -v
向您顯示遠程 GitHub 存儲庫的 URL 作為源git@github.com:<you>/<yourRepo>
)然后push,回到VSCode。
應該比其他解決方案更快:
git push
並接受新密鑰。這將存儲遙控鑰匙以供將來使用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.