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



目录
相关文章
|
开发工具 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
320 24
|
9月前
|
网络协议 开发工具 git
解决 git 报错 “fatal: unable to access ‘https://github.com/.../.git‘: Recv failure Connection was rese
在使用 Git/Git小乌龟 进行代码管理的过程中,经常会遇到各种各样的问题,其中之一就是在执行 git clone 或 git pull 等操作时出现 “fatal: unable to access ‘https://github.com/…/.git’: Recv failure Connection was reset” 的报错。这个问题通常是由网络连接问题或代理设置不正确导致的。在我的个人使用经验中,我亲自尝试了四种方法,它们都能够有效地解决这个报错。个人比较推荐方法二。
6225 1
|
开发工具 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 报错如何解决-优雅草卓伊凡
973 3
git 使用之remote: File [4e21e71a555febaa4dfaaa05cf7eeb606ea96ae2] size 104.090MB, exceeds quota 100MB remote: Please remove the file[s] from history and try again 报错如何解决-优雅草卓伊凡
|
网络安全 开发工具 git
解决fatal:remote error:You can’t push to git://github.com/username/*.g
通过上述诊断与修复步骤,绝大多数的推送错误都能得到有效解决,确保您的Git工作流顺畅无阻。
701 1
|
6月前
|
开发工具 git
Git版本控制工具合并分支merge命令操作流程
通过以上步聚焦于技术性和操作层面指南(guidance), 可以有效管理项目版本控制(version control), 并促进团队协作(collaboration).
1520 15
|
9月前
|
安全 开发工具 git
git的常用操作命令
git的常用操作命令
560 57
|
7月前
|
存储 缓存 开发工具
Git stash命令的详细使用说明及案例分析。
通过上述案例,我们看到stash命令能够在不丢失进度的情况下,帮助开发者临时切换开发上下文,这在处理多个任务或紧急bug时特别有用。正确使用Git stash可以大大提高开发的灵活性和效率。
2257 0
|
人工智能 前端开发 Java
用git rebase命令合并开发阶段中多条commit提交记录
通过 `git rebase`,可以合并多个提交记录,使开发历史更简洁清晰。操作分为 6 步:查看提交历史 (`git log --oneline`)、设置需合并的提交数 (`git rebase -i HEAD~N`)、修改动作标识为 `s`(squash)、保存退出编辑、调整提交信息、强制推送至远程仓库 (`git push -f`)。此方法适合清理本地无关提交,但若有团队协作或冲突风险,需谨慎使用以避免问题。
2072 60
|
10月前
|
存储 项目管理 开发工具
Git常用命令及操作技巧
以上是Git的常用命令及操作技巧,尽管看起来有些繁琐,但实际上只要花费一些时间进行实践,您将很快熟练掌握。随着使用熟练度的提高,您会发现Git对项目管理和协同工作的强大帮助。
241 20