fatal: Authentication failed could not read from remote repository

2024-06-10 02:38

本文主要是介绍fatal: Authentication failed could not read from remote repository,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

Git 无法clone、pull、fetch

异常:

fatal: could not read from remote repository
fatal: Authentication failed for 'http://git.example.com/example/master.git/'

所在公司使用Git版本管理工具,由于以前用的都是SVN,所以不是很熟悉,公司用一个Git账号,个人有一个GitHub账号,我就想配置两套账号,然后就出现了上面的异常。

出现异常之前

配置好了Git的SSH,相应的地方添加了Key。
Git Bash处于当前Git目录下

ssh-keygen -t rsa -C “example@163.com”

然后找到C:\Users\Administrator.ssh\id_rsa.pub,将里面的Key添加到Git SSH Key中,然后我发现使用的时候还是需要输入账号密码(因为我之前用Eclipse通过http下载的源码),也没有深究为什么还要输入账号和密码。

配置多Git账号

1.生成SSH,及上面的命令,注意”id_rsa.pub”这个是默认名,记得改。我的是 “id_rsa_github.pub”
2.添加自己的config文件,在同一目录下

Host github.comHostName github.comUser xukaiIdentityFile ~/.ssh/id_rsa_github
Host git.example.comHostName git.example.comUser xukai1IdentityFile ~/.ssh/id_rsa

3.切换到SSH协议
GitHub的Repository我是在本地电脑通过GitHub Desktop创建的。走的也是http协议,修改为SSH

git remote -v   //查看详细
git remote set-url origin https://github.com/USERNAME/REPOSITORY_2.git
ssh -T git@github.com

最后一行是测试SSH是否配置成功,成功会显示username。

出现异常

通过上面的GitHub测试,我打算把公司账号Git的问题解决一下,将协议切换到SSH,然后pull,就出现了标题上的问题,开始以为是因为我配置了两个账号的问题,然后把两个账号的配置文件ctrl+x,backup。
从头来过,重新配置SSH,生成Key,添加Key,pull,不行,clone,不行;
重启电脑
从头来过,重新配置SSH,生成Key,添加Key,pull,不行,clone,不行。崩溃了~
测试了一下

ssh -T git@git.example.com

我的账号显示Welcome,SSH配置是对的!
使用GitHub Desktop进行clone,pull都没问题,于是我怀疑了Git Bash了。

解决

原因是因为Git for Windows这个软件的Bug。Cannot pull/fetch/clone/push with Git for Windows 2.14 over SSH
升级软件就好了。

git --version   // 查看当前Git Bash版本

我的之前是git version 2.14.1.windows.0
下载了一个新版本git version 2.14.1.windows.1,完美运行~
官方链接:Gitlab
其他:
https://stackoverflow.com/questions/45532727/unable-to-clone-pull-push-a-repository-with-git-for-windows-2-14-over-ssh
https://stackoverflow.com/questions/29588258/gitlab-shell-disallowed-command
*Git For Windows开源的

这篇关于fatal: Authentication failed could not read from remote repository的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1047007

相关文章

SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED]

python 在使用websocket 或者request可能会报这个错误,这是证书认证中的错误,如果不是对安全要求高的开发,可以使用下面的方式使request与websocket正常访问   在request中修改一个参数即可正常使用: textmod = {     "ID": "T214",      "Longitude": 123.6355038767646,      "Lati

nginx 8051#0: *4 recv() failed (104: Connection reset by peer) while reading response header from u

环境    php7   nginx1.8.0    nginx   报错  500  GATWAY网关错误 2017/08/28 10:45:42 [error] 7975#0: *333 recv() failed (104: Connection reset by peer) while reading response header from upstream, clien

文件权限修改为777,php failed to open stream: Permission denied

记录一次在谷歌云上的异常诡异的事件: 环境 centos7.5 nginx php7.0 mysql 问题: 问题一 我用相同的nginx配置,只是修改了nginx root目录。 打开/var/www/html/ 这个目录就报 2018/06/22 04:35:03 [error] 15840#0: *438 FastCGI sent in stderr: “Primary scr

【鸿蒙】ERROR_GET_BUNDLE_INSTALLER_FAILED

错误信息 [ERROR_GET_BUNDLE_INSTALLER_FAILED] Troubleshooting guide $ hdc file send D:\Huawei\devEcoProjects\entry\build\default\outputs\default\entry-default-unsigned.hap /sdcard/e8a215ea7be1444197e6a58e

VMWARE 安装失败 “FAILED TO CREATE THE REQUESTED REGISTRY KEY KEY

问题详情: 安装虚拟机VMWare Workstation8.0时出现“failed to create the requested registry key key installer error 1021” 解决问题: 1.在注册表(开始--运行[win+R]--输入regedit)中找到HKEY_LOCAL_MACHINE\SOFTWARE\VMware, Inc. 将V

vue dist文件打开index.html报Failed to load resource: net::ERR_FILE_NOT_FOUND

本地正常。打包好的dist文件打开index.html报Failed to load resource: net::ERR_FILE_NOT_FOUND 解决办法: 在webpack.prod.conf.js 中output添加参数publicPath:’./’ 在webpack.base.conf.js里 publicPath: process.env.NODE_ENV === ‘pro

github 报错 git fatal: unable to write new index file

错误一:git fatal: unable to write new index file主要原因就是服务器磁盘空间不够导致的,增加服务器空间就OK了在百度上面搜索没得到什么有效信息,在gooogle上搜索得到很多有效信息 Finding large directories with something like the following helped clean up some log fi

Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接

在进行参数化读取时发现一个问题: 发现问题: requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8081): Max retries exceeded with url: /jwshoplogin/user/update_information.do (Caused by NewConn

前端项目报错chunk-libs.e495f7a4.js:41 Failed to execute ‘postMessage‘ on ‘DOMWindow‘:

最近一次vue项目打包之后,在控制台出现了一个错误如下 chunk-libs.e495f7a4.js:41 Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('file://') does not match the recipient window's origin ('null').

FFplay源码分析-read_thread

《FFmpeg原理》的社群来了,想加入社群的朋友请购买 VIP 版,VIP 版有更高级的内容与答疑服务。 本系列 以 ffmpeg4.2 源码为准,下载地址:链接:百度网盘 提取码:g3k8 FFplay 源码分析系列以一条简单的命令开始,ffplay -i a.mp4。a.mp4下载链接:百度网盘,提取码:nl0s 。 如下图所示,本文主要讲解 read_thread() 函数的内