Search code examples
gitgithubvisual-studio-codecredentials

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


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.


Solution

  • 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.