- 29
- 0
环境
- w10
- vscode
- git
- tortoisegit
问题描述
- 当我使用
tortoisegit进行push操作时,一切正常 - 当我使用
vscode进行push操作时,提示如下错误
> git push origin master:master
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
- 是同一个项目,用
tortoisegit配置了PPK密钥 -
github配置了本机的ssh密钥
希望大佬指点一下,十分感谢
- 共 0 条
- 全部回答
-
╭初夏ぃ染指忧伤つ 普通会员 1楼
The "Host key verification failed" error message in Git can occur when the server you are pushing to does not accept the public key of the repository you are pushing to. This can happen when the server is configured to use a specific authentication method (such as SSH or HTTPS) and the public key provided by the repository is not valid or the private key is not properly configured.
Here are some steps you can take to resolve this issue:
- Verify the repository's public key:
- Check the URL of the repository's public key file on GitHub, GitLab, or Bitbucket. This file is typically located in the
.ssh/authorized_keysdirectory of the repository. Look for the key with the.pubextension, likegit@github.com/user/repo.git. - Double-check the key's authenticity by running the following command in your terminal:
ssh -i <repository_key_file.pub> git@github.com:user/repo.git -
If the output of the command shows the public key is valid and does not contain any unauthorized characters, then the key is properly configured and can be pushed to the repository.
-
If the public key is invalid or has unauthorized characters, you can regenerate the key:
- If the public key is valid but contains unauthorized characters, you can regenerate the key using the following command:
ssh-keygen -t rsa -b 4096 -C "user@example.com" - This command generates a new RSA private key with a 4096-bit key size and adds the specified email address as the public key's recipient.
- After the key generation process is complete, replace the old public key with the new one:
git mv <repository_key_file.pub> <repository_key_file_new.pub> - Then, run the command again to push the updated public key:
git push -u origin master - If the error message is still present, try running the command with the
-doption to detach the local repository and generate a new one with the updated key:git push -d origin master -
This command creates a new detached repository and prompts you to select the public key from the
.ssh/authorized_keysdirectory of the local repository. -
Verify the repository's private key:
- If the private key is not present, you can generate a new one by running the following command:
ssh-keygen -t rsa -b 4096 -C "user@example.com" - Follow the same steps as step 2 to regenerate the private key.
- After the key generation process is complete, replace the old private key with the new one:
git mv <repository_key_file_new.pub> <repository_key_file_old.pub> - Then, run the command again to push the updated private key:
git push -u origin master - If the error message is still present, try running the command with the
-doption to detach the local repository and generate a new one with the updated key:git push -d origin master - This command creates a new detached repository and prompts you to select the private key from the
.ssh/authorized_keysdirectory of the local repository.
By following these steps, you should be able to resolve the "Host key verification failed" error message in Git and push your changes to the repository without encountering any issues. If the error persists, you may need to check the server's configuration, authentication method, or the permissions of the repository's public key file.
- 扫一扫访问手机版
回答动态

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器更新之后。服务器里面有部分玩家要重新创建角色是怎么回事啊?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题函数计算不同地域的是不能用内网吧?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题ARMS可以创建多个应用嘛?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题在ARMS如何申请加入公测呀?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题前端小程序接入这个arms具体是如何接入监控的,这个init方法在哪里进行添加?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器刚到期,是不是就不能再导出存档了呢?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器的游戏版本不兼容 尝试更新怎么解决?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器服务器升级以后 就链接不上了,怎么办?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器转移以后服务器进不去了,怎么解决?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器修改参数后游戏进入不了,是什么情况?预计能赚取 0积分收益
- 回到顶部
- 回到顶部
