解决mac更新后无法连接git问题

问题描述

在Mac电脑上使用git克隆命令时出现报错:

bash 复制代码
no matching host key type found. Their offer: ssh-rsa

问题原因

苹果更新了ssh默认不再支持ssh-rsa导致。

问题解决

修改ssh默认config配置文件,再重新生成rsa密钥

bash 复制代码
sudo nano ~/.ssh/config

写入文本:

bash 复制代码
Host *
    HostkeyAlgorithms +ssh-rsa
    PubkeyAcceptedAlgorithms +ssh-rsa

重新生成密钥:

bash 复制代码
ssh-keygen -t rsa
cat ~/.ssh/id_rsa.pub
相关推荐
weixin_445476681 天前
Git Cherry-pick & Clean Push 解决方案
git
REDcker1 天前
Git 原理解析
git
Mo_YuO.o1 天前
git的安装以及本地仓库的创建
git·gitee·github
CoderJia程序员甲1 天前
GitHub 热榜项目 - 日榜(2026-01-19)
git·ai·开源·llm·github
txinyu的博客1 天前
MAC 地址
服务器·网络·macos
-大头.1 天前
GIT教程系列(共3篇)---------第二篇:Git高级协作与团队实战完全指南
大数据·git·elasticsearch
小胖红1 天前
Xcode 打包失败 处理
ide·macos·xcode
Q741_1471 天前
Git 添加文件基本操作与简单原理
git
June bug1 天前
【实习笔记】客户端基础技术
笔记·macos·cocoa
好评1241 天前
git常见操作及问题
linux·git