I have been using the TortoiseGit
tool to operate Git, but switching back and forth between windows feels cumbersome when using VSCode's built-in support.
Today, I finally tried to commit and push using VSCode, but encountered the following error message:
Git: Host key verification failed
It may also appear in this form:
Warning: Permanently added 'github.com,192.30.255.113' (RSA) to the list of known hosts.
Solution:
Execute the following command:
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
Source:
Failed to authenticate git remote
Or
Permission denied (publickey).
It is recommended to use SSH authentication.
-
Change the remote address to
[email protected]:wdssmq/HelloZBlog.git
format. -
Open Git Bash and execute:
cd ~/.ssh
ssh-keygen -t ecdsa
# Display the path of the .ssh folder
pwd
# c/Users/Username/.ssh
- Find
id_ecdsa.pub
in the corresponding path and open it with an editor. Copy the content and add it to your GitHub account.
You can click the link to add it directly:
Add new SSH keys: https://github.com/settings/ssh/new
After that, you can perform commit operations in 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
Solution:
The RSA algorithm is considered insecure (mainly depending on the key length).
A more direct method is to change the algorithm to ecdsa or ed25519, with the latter being more secure. However, if you encounter the prompt unknown key type ed25519
in an older environment, choose the former.
ssh-keygen -t ed25519
# unknown key type ed25519
ssh-keygen -t ecdsa
Related:
【Memo】msysGit Installation and Usage
Press ctrl + shift + g
to switch to Git management.