Github The requested URL returned error: 403 remote: Permission to user

Viewed 8285

I have two GitHub accounts with two different email IDs,

Currently, my .gitconfig is as follows;

[filter "lfs"]
    process = git-lfs filter-process
    clean = git-lfs clean -- %f
    smudge = git-lfs smudge -- %f
    required = true
[user]
    name = joshinachiket
    email = nachiket.r.joshi@gmail.com
[core]
    autocrlf = true
    excludesfile = C:\\Users\\NACHIKET\\Documents\\gitignore_global.txt

Still, when I want to commit to the repository it says that,

remote: Permission to joshinachiket/CMPE295-enterprise-grade-botman.git denied to TheBloodMage.
fatal: unable to access 'https://github.com/joshinachiket/CMPE295-enterprise-grade-botman.git/': The requested URL returned error: 403

where TheBloodMage is my user id from other github email id.

The .gitconfig contents that I showed in the question are of the account in which I have created the repository and the ID TheBloodMage is of some other github account(my old) that I DON'T want to give access to.

So basically,

  1. I created a repository with github id - joshinachiket

  2. I cloned the repository on a computer with .gitconfig showing same ID and email as shown above

  3. Still, the error says that TheBloodMage have no rights to access the repository.

I am stuck on this problem for a long time now... Can anyone please advise what am I doing wrong?

2 Answers

Double-check if you have a credential helper that would have cached your (old account) credentials (username/password) used to authentication you.

git config credential.helper 

On Windows, that would be the Windows Credential Managers.
Open the Windows Credential Store, and see if the first user is registered there: delete that entry, and you will be able to authenticate with the second user.

(Here is an example for BitBucket)

https://kwilson.io/blog/wp-content/uploads/2015/01/4-store.png

Related