git使用ssh clone时报错

使用ssh地址 clone 时可能会出现以下错误

Cloning into 'music'...
The authenticity of host 'gitee.com (*.*.*.*)' can't be established.
ECDSA key fingerprint is SHA256:FQGC9Kn/eye1W8icdBgrQp+KkGYoFgbVr17bmjey0Wc.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'gitee.com,*.*.*.*' (ECDSA) to the list of known hosts.
git@gitee.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

解决方案:
先删除.ssh文件夹
在cmd执行以下操作

ssh-keygen -t rsa -C "仓库账号"
一路回车
Generating public/private rsa key pair.
Enter file in which to save the key (C:\Users\Administrator/.ssh/id_rsa):  
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in C:\Users\Administrator/.ssh/id_rsa.
Your public key has been saved in C:\Users\Administrator/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:c8bnbdAxC2/bpv93AlQKgQURlIpxVu3fgO4iMtuPigc '1793337019@qq.com'
The key's randomart image is:
+---[RSA 2048]----+
|       o*Oo.     |
|    . o o o   .  |
|     = . . o.oo  |
|    . .  .o ++ + |
|        S.+ooo=  |
|  E      +.oo+.o |
|   .     .  ..+ o|
|   .+.... .  ..oo|
|  ..o=oo..    .o*|
+----[SHA256]-----+

此时已生成id_rsa.pub 文件,到github等远端仓库配置ssh公钥,即可

码云:设置->ssh公钥
github:settings->SSH and GPG keys
posted @   _DC  阅读(1291)  评论(0编辑  收藏  举报
编辑推荐:
· 理解Rust引用及其生命周期标识(下)
· 从二进制到误差:逐行拆解C语言浮点运算中的4008175468544之谜
· .NET制作智能桌面机器人:结合BotSharp智能体框架开发语音交互
· 软件产品开发中常见的10个问题及处理方法
· .NET 原生驾驭 AI 新基建实战系列:向量数据库的应用与畅想
阅读排行:
· 2025成都.NET开发者Connect圆满结束
· 在 VS Code 中,一键安装 MCP Server!
· 后端思维之高并发处理方案
· langchain0.3教程:从0到1打造一个智能聊天机器人
· 千万级大表的优化技巧
点击右上角即可分享
微信分享提示