【Mac + GitHub】之在另一台Mac电脑上下载GitHub的SSH链接报错

当输入git命令github项目时报错:

⇒  git clone git@github.com:/TX-Class.git
Cloning into 'TX-Class'...
Warning: Permanently added the RSA host key for IP address '13.250.177.223' to the list of known hosts.
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

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

错误①:

Warning: Permanently added the RSA host key for IP address '13.250.177.223' to the list of known hosts.

此错误参考:《git提交警告Warning: Permanently added the RSA host key for IP address '13.250.177.223' to the list of

hosts文件的位置:

1、Mac:/etc/hosts

vim /etc/hosts

添加一行:13.250.177.223  github.com

但是修改完文件输入::wq!时报错

Can't open file for writing

解决参考:《linux操作提示:“Can't open file for writing”或“operation not permitted”的解决办法

修改文件命令时,应该用sudo

 

sudo vim /etc/hosts

 

再修改成功!!

错误②

fatal: Could not read from remote repository.

参考文章:《GIT 出现fatal: Could not read from remote repository.解决

 

输入命令:

ssh-keygen -t rsa -C xxx@xxx.com

xxx@xxx.com # 为你的github账号

一直按回车,什么都不输入。

复制代码
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/[username]/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/[username]/.ssh/id_rsa.
Your public key has been saved in /Users/[username]/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:HyXP86ndZiNVOchlHrHMriy5SoHredqReKwESZgtZx4 xxx@xxx.com
The key's randomart image is:
+---[RSA 2048]----+
|               ..|
|    +         o+.|
|   + E    . o =+o|
|    * o .  = o.+.|
|     + .S.. +  .o|
|      . +.o.oo.o |
|       + *.o o+  |
|      o *.. o+ oo|
|       =oo... ooo|
+----[SHA256]-----+
复制代码

再输入:

cd ~/.ssh

ls
# 如果有下面几个文件就成功了
id_rsa      id_rsa.pub  known_hosts

接下来打开github官网:选择设置

添加新的SSH key

复制新的key内容,输入:

pbcopy < ~/.ssh/id_rsa.pub

复制完粘贴到下面如图里

 新的keys

最后就可以下载github中的SSH链接的项目了:

 

posted @   Owen_ET  阅读(649)  评论(0编辑  收藏  举报
编辑推荐:
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 如何调用 DeepSeek 的自然语言处理 API 接口并集成到在线客服系统
· 【译】Visual Studio 中新的强大生产力特性
· 2025年我用 Compose 写了一个 Todo App
  1. 1 イエスタデイ(翻自 Official髭男dism) 茶泡饭,春茶,kobasolo
  2. 2 模様 (TV size ver.) Ivy to Fraudulent Game
  3. 3 河口恭吾
  4. 4 愛してる 高鈴
  5. 5 一生所爱 卢冠廷,莫文蔚
  6. 6 世间美好与你环环相扣 柏松
  7. 7 理想三旬 陈鸿宇
  8. 8 不浪漫罪名 王杰
  9. 9 樱花树下 张敬轩
  10. 10 因为你在 达闻西乐队,福禄寿FloruitShow
  11. 11 悬溺 葛东琪
一生所爱 - 卢冠廷,莫文蔚
00:00 / 00:00
An audio error has occurred, player will skip forward in 2 seconds.

作词 : 唐书琛

作曲 : 卢冠廷

从前现在过去了再不来

红红落叶长埋尘土内

开始终结总是没变改

天边的你飘泊白云外

苦海翻起爱恨

在世间难逃避命运

相亲竟不可接近

或我应该相信是缘分

情人别后永远再不来(消散的情缘)

无言独坐放眼尘世外(愿来日再续)

鲜花虽会凋谢(只愿)但会再开(为你)

一生所爱隐约(守候)在白云外(期待)

苦海翻起爱恨

在世间难逃避命运

相亲竟不可接近

或我应该相信是缘分

苦海翻起爱恨

在世间难逃避命运

相亲竟不可接近

或我应该相信是缘分

点击右上角即可分享
微信分享提示