沉冰浮水

沉冰浮水

做最终到的事,成为最终成为的人!
github
bilibili
mastodon
zhihu
douban

「VSCode 筆記」Git:主機金鑰驗證失敗

一直使用TortoiseGit這個工具來操作 Git,然而 VSCode 內置支援的情況下來回切換視窗感覺很不優美。。

今天終於第一次嘗試用 VSCode 提交和推送,但是報了錯誤提示:

Git: Host key 驗證失敗

也可能是這種形式

Warning: Permanently added 'github.com,192.30.255.113' (RSA) to the list of known hosts.

解決方法:

執行如下命令

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

來源:

ssh - Git error: 'Host Key Verification Failed' when connecting to remote repository - Stack Overflow


未能對 git remote 進行身份驗證

或者

Permission denied (publickey).

建議使用 SSH 驗證。

1、將遠程地址改為 [email protected]:wdssmq/HelloZBlog.git 的形式;

2、打開 Git Bash 執行:

cd ~/.ssh
ssh-keygen -t ecdsa
# 列出.ssh文件夾的路徑
pwd
# c/Users/用戶名/.ssh

3、在對應路徑中找到 id_ecdsa.pub ,使用編輯器打開,將其中的內容複製添加到 GitHub 帳號中。

可點擊連結直接添加:

Add new SSH keys:https://github.com/settings/ssh/new

之後即可在 VSCode 中進行提交操作;


ERROR: You're using an RSA key with SHA-1, which is no longer allowed. Please use a newer client or a different key type

解決:

RSA 算法已被認為不再安全(主要取決於密鑰長度);

更直接的方法是更換算法為 ecdsa 或 ed25519,兩者之間後者更安全,當然如果你的環境較舊,出現了unknown key type ed25519的提示,那麼就選前者;

ssh-keygen -t ed25519
# unknown key type ed25519
ssh-keygen -t ecdsa

相關:

【備忘】msysGit 安裝及使用

【VSCode】快捷鍵備忘

ctrl + shift + g即可切換到 Git 管理。

【折騰】VSCode 遠程開發配置(Remote Development)

載入中......
此文章數據所有權由區塊鏈加密技術和智能合約保障僅歸創作者所有。