git@github.com: Permission denied (publickey). fatal: Could not read from remote repository的问题解决

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.
Failed during: git fetch origin master:refs/remotes/origin/master --tags --force

 

大概率是秘钥设置不对的问题。

首先检查有没有在GitHub的https://github.com/settings/keys上添加你本机的SSH key。注意换了电脑是要重新添加的,每台都不一样。添加SSH key的方法:(引自廖雪峰老师的教程)
在用户主目录下,看看有没有.ssh目录,如果有,再看看这个目录下有没有id_rsa和id_rsa.pub这两个文件,如果已经有了,可直接跳到下一步。如果没有,打开Shell(Windows下打开Git Bash),创建SSH Key:

$ ssh-keygen -t rsa -C "youremail@example.com"
你需要把邮件地址换成你自己的邮件地址,然后一路回车,使用默认值即可。

如果一切顺利的话,可以在用户主目录里找到.ssh目录,里面有id_rsa和id_rsa.pub两个文件,这两个就是SSH Key的秘钥对,id_rsa是私钥,不能泄露出去,id_rsa.pub是公钥,可以放心地告诉任何人。

第2步:登陆GitHub,打开“Account settings”,“SSH Keys”页面:

然后,点“Add SSH Key”,填上任意Title,在Key文本框里粘贴id_rsa.pub文件的内容:

点“Add Key”,你就应该看到已经添加的Key:

 

如果添加了还是出现这个问题,那么问题大概率就定位在了你本机的这个git仓库并没有和这个SSH key 关联上。用下述方法解决:
ssh-add "你的 id-rsa 文件地址"
注意这里ssh-add后面填的是私钥地址,如mac电脑是 /Users/用户名/.ssh/id_rsa

add之后可以用

$ ssh git@github.com
验证是不是添加成功。

 

有时候你GitHub仓库初始化时候带了Readme或其他文件,推送之前需要先git pull 拉下来,会报“ * branch master  -> FETCH_HEAD  fatal: 拒绝合并无关的历史”的错误,解决方法是在git pull时加上–allow-unrelated-histories,如下:
git pull origin master --allow-unrelated-histories
这样应该就可以正常push了。
 

回答: 根据提供的引用信息,这个错误是在运行一个叫做“webui-user.bat”的文件时出现的。错误提示表明程序试图安装名为“open_clip”的包,但是安装失败了。具体的错误信息如下:Running command git clone –filter=blob:none –quiet https://github.com/mlfoundations/open_clip.git ‘C:\Users\Administrator\AppData\Local\Temp\pip-req-build-0bs_j2f1’ error: RPC failed; curl 18 HTTP/2 stream 3 was not closed cleanly before end of the underlying stream fatal: expected flush after ref listing error: subprocess-exited-with-error git clone –filter=blob:none –quiet https://github.com/mlfoundations/open_clip.git ‘C:\Users\Administrator\AppData\Local\Temp\pip-req-build-0bs_j2f1’ did not run successfully. exit code: 128 See above for output. note: This error originates from a subprocess, and is likely not a problem with pip. [1] 同时,在引用中提到了一种可能的解决方法。您可以先输入 cd ~/.ssh 查询.ssh文件,如果找不到的话就直接创建一个,输入 mkdir ~/.ssh,然后设置账号和邮箱,输入git config --global user.name '账号名' 和 git config --global user.email '邮箱',接着输入 ssh-keygen -t rsa -C '邮箱' 生成公钥。提到了在执行git clone https://github.com/Stability-AI/stablediffusion.git命令时无法下载Stable-Diffusion-Stability-AI库的问题。这个错误是由于PyPI的问题导致的,可能与pip无关。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [【Stable Diffusion】安装过程中常见报错解决方法](https://blog.csdn.net/Bankcary/article/details/131237002)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"] - *2* [github报错:git@github.com: Permission denied (publickey).fatal: Could not read from remote repository](https://blog.csdn.net/waitle500/article/details/122960022)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论 11
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值