git 使用过程中遇到的问题does not appear to be a git repository Could not read from remote respository...

本文详细介绍了如何通过生成SSH密钥来解决本地Git库上传至GitHub时遇到的读取远程仓库失败的问题。步骤包括检查SSH密钥存在性,生成新的SSH密钥,以及将公钥添加至GitHub账户。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

想把本地的git库上传到github上。github已经新建了一个public仓库,利用网站的命令

git Bash报错:does not appear to be a git repository  Could not read from remote respository

    

网上搜索了一下,说是github的公钥没有生成,但是网上搜索到的方法不能解决我的问题,去官网自己看,有生成公钥的方法

链接:https://help.github.com/en/articles/connecting-to-github-with-ssh 照着文档操作就可以了

 

1、检查是否存在SSH key:

$ ls -al ~/.ssh

类型如下:pub是公钥。

  • id_dsa.pub
  • id_ecdsa.pub
  • id_ed25519.pub
  • id_rsa.pub

2、Generating a new SSH key :email是你注册github的邮箱

$ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

3、出现下面信息时,回车就好:

Enter a file in which to save the key (/c/Users/you/.ssh/id_rsa):[Press enter]

4、重新打开git Bash

再次检查SSH key

5、cat id_rsa.pub 打开秘钥文档复制里面的公钥添加到 setting-SSH and GPG keys-new SSH key里 重新登录github就好

 

转载于:https://www.cnblogs.com/t-ae/p/10730755.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值