5

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?

Nachiket Joshi
  • 101
  • 2
  • 13
  • Possible duplicate of [Multiple github accounts on the same computer?](https://stackoverflow.com/questions/3860112/multiple-github-accounts-on-the-same-computer) – phd Nov 12 '17 at 10:21

2 Answers2

7

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

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
1

You have GitHub repository: http://github.com/user_name/repository_name

You have 2 accounts, you want another account access to a exist repository.

Go to https://github.com/user_name/repository_name/settings/collaboration

do like this enter image description here

Vy Do
  • 46,709
  • 59
  • 215
  • 313
  • The .gitconfig contents that I showed in the question are of the github account in which I have created the repository. And the ID TheBloodMage is of some other github account that I DONT 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 cannot access the repository. And that is my question. Sorry for any confustion. – Nachiket Joshi Nov 13 '17 at 02:18