Mate Mrše
Mate Mrše

Reputation: 8414

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.

Upvotes: 1

Views: 1110

Answers (1)

Mate Mrše
Mate Mrše

Reputation: 8414

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://[email protected]/my-username/my-repo.git

to

ssh://[email protected]/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.

Upvotes: 1

Related Questions