How to change Github local repo .git/config credentials to circumvent 403?

橙三吉。 提交于 2021-02-04 08:14:10

问题


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

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

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


回答1:


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

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

to

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.



来源:https://stackoverflow.com/questions/63636504/how-to-change-github-local-repo-git-config-credentials-to-circumvent-403

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!