如何更改Github本地仓库.git/config凭据以绕过403? [英] How to change Github local repo .git/config credentials to circumvent 403?

查看:75
本文介绍了如何更改Github本地仓库.git/config凭据以绕过403?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从设置了其他凭据的工作PC推送到我的远程Github存储库,这就是我得到的:

I'm trying to push to my remote Github repository from my work PC that has other credentials set up and this is what I get:

remote: Permission to *** denied to ***.
fatal: unable to access 'https://github.com/***': The requested URL returned error: 403

我尝试更改 .gitconfig ,但这无济于事.

I tried changing .gitconfig but it didn't help.

我怀疑VS代码以某种方式记住了工作凭证,但是我找不到它在哪里.

I suspect VS code is somehow remembering the work credentials but I'm unable to find where is it.

推荐答案

找到了答案

Found an answer here. At the end, it wasn't about resetting VS code credentials.

在您的repo目录下的 .remote"origin"] 部分下找到 .git/config 文件,将URL更改为

Find .git/config file under your repo directory and under section [remote "origin"] change the url from

https://my-username@github.com/my-username/my-repo.git

ssh://git@github.com/my-username/my-repo.git .

在那之后,我能够毫无问题地向上游推进.我不太明白为什么,但是可以.

After that, I was able to push upstream with no problems. I don't quite understand why, but it works.

这篇关于如何更改Github本地仓库.git/config凭据以绕过403?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆