git 提示:fatal: Could not read from remote repository.

简介: git 提示:fatal: Could not read from remote repository.

解决

  1. 生成新的SSH key



执行下面命令

ssh-keygen -t rsa -C "填识别用的key,比如:你的邮箱"

7826bba5af5bd45103f363b6a160e3cd.png


补充:ssh-keygen(基于密匙的安全验证)

需要依靠密钥进行安全验证,必须为自己创建一对密钥,并把公用密钥放在需要访问的服务器上,让本地机器 ssh 登录远程机器上的 GitHub 账户无需输入密码。


比如:ssh-keygen -t rsa -b 1024 -f yourkeyname -C "备注"


30b3d2cb0a0d1230205a934e96caaf67.png


更多参数可运行 man ssh-keygen

参考链接:ssh-keygen

  1. 将SSH key 添加到 ssh-agent


执行下面命令,将产生的新 ssh key 添加到 ssh-agent 中:

ssh-add ~/.ssh/id_rsa



f116831c7fa72bf21088d8c5aa427b22.png


如果报提示了:Could not open a connection to your authentication agent.

在执行下面命令之后再次执行上面的命令:

eval `ssh-agent`


e26096b410ebf32dc24c14e678cb91b2.png


  1. 将SSH key 添加到 GitHub 账户

找到本地文件:id_rsa.pub 打开,将里面的文本复制粘贴到 github 新建的 SSH keys 里,如下图:


b3a29dd65d4cf3941a5d6a4be1d07162.png


找到下图的位置,点击 New SSH keys

f0f9e01056f6c0b13ab2f26bfb3f535f.png


将上面复制的内容粘贴到 Key, Title 的话自己随便命名一个就行,然后点击 Add SSH keys

f3dc87502ad127ee9da4f2167683238a.png


  1. 验证key,使用 下面命令对ssh key 进行验证:
ssh -T git@github.com


6db0591a28ca75d2ffe33505715bfaab.png



目录
相关文章
|
4月前
|
开发工具 git C++
【App Service】VS Code直接部署App Service时候遇见 “fatal: not a git repository (or any of the parent directories): .git”
通过VS Code发布Python App Service的时候,遇见了发布失败错误: The deployment failed with error: fatal: not a git repository (or any of the parent directories): .git . Please take a few minutes to help us improve the deployment experience
110 24
|
8天前
|
开发工具 git
git 使用之remote: File [4e21e71a555febaa4dfaaa05cf7eeb606ea96ae2] size 104.090MB, exceeds quota 100MB remote: Please remove the file[s] from history and try again 报错如何解决-优雅草卓伊凡
git 使用之remote: File [4e21e71a555febaa4dfaaa05cf7eeb606ea96ae2] size 104.090MB, exceeds quota 100MB remote: Please remove the file[s] from history and try again 报错如何解决-优雅草卓伊凡
25 3
git 使用之remote: File [4e21e71a555febaa4dfaaa05cf7eeb606ea96ae2] size 104.090MB, exceeds quota 100MB remote: Please remove the file[s] from history and try again 报错如何解决-优雅草卓伊凡
|
3月前
|
网络安全 开发工具 git
解决fatal:remote error:You can’t push to git://github.com/username/*.g
通过上述诊断与修复步骤,绝大多数的推送错误都能得到有效解决,确保您的Git工作流顺畅无阻。
299 1
|
5月前
|
Shell 网络安全 开发工具
fatal: unable to access 'https://github.com/wolfcw/libfaketime.git/': Encountered end of file
fatal: unable to access 'https://github.com/wolfcw/libfaketime.git/': Encountered end of file
|
开发工具 git
聊下 git remote prune origin
在你经常使用的命令当中有一个git branch –a 用来查看所有的分支,包括本地和远程的。但是时间长了你会发现有些分支在远程其实早就被删除了,但是在你本地依然可以看见这些被删除的分支。 你可以通过命令,git remote show origin 来查看有关于origin的一些信息,包括分支是否tracking。
1172 0
|
3月前
|
开发工具 git
git 常用命令
这些只是 Git 命令的一部分,Git 还有许多其他命令和选项,可根据具体需求进行深入学习和使用。熟练掌握这些命令能够帮助你更高效地管理代码版本和协作开发。
|
28天前
|
网络安全 开发工具 git
mac git clone命令提示git@gitee.com: Permission denied (publickey).问题修复
mac git clone命令拉取gitee上项目代码时提示密钥问题
|
27天前
|
Java 网络安全 开发工具
Git进阶笔记系列(01)Git核心架构原理 | 常用命令实战集合
通过本文,读者可以深入了解Git的核心概念和实际操作技巧,提升版本管理能力。
|
2月前
|
机器学习/深度学习 Shell 网络安全
【Git】Git 命令参考手册
Git 命令参考手册的扩展部分,包含了从基础操作到高级功能的全面讲解。
74 3
|
3月前
|
缓存 Java Shell
[Git]入门及其常用命令
本文介绍了 Git 的基本概念和常用命令,包括配置、分支管理、日志查看、版本回退等。特别讲解了如何部分拉取代码、暂存代码、删除日志等特殊需求的操作。通过实例和图解,帮助读者更好地理解和使用 Git。文章强调了 Git 的细节和注意事项,适合初学者和有一定基础的开发者参考。
75 1
[Git]入门及其常用命令