5

I made my new account "kim2" but when I push it with "kim2"
It gives following error:

kim-computer:Kaggle-A-Z kim2$ git push kim2 master
remote: Permission to  kim2/Kaggle-A-Z.git denied to kim1.
fatal: unable to access 'https://github.com/kim/Kaggle-A-Z.git/': 
The requested URL returned error: 403

I changed the global user.name and global user.email to new user ID

I'm using HTTPS not SSH.
Any Solution?

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
jojo kim
  • 141
  • 3
  • 7

5 Answers5

10

I also had the same issue with Mac, I hope this would be helpful for the mac users.

  1. Open Keychain Access app.
  2. Search for github.com
  3. Delete the information of other users

The problem is Mac tries to cache the user name , so my account was trying to commit with the previous credentials.

Nirojan Selvanathan
  • 10,066
  • 5
  • 61
  • 82
1

First, user.name/email has nothing to do with ssh or https url.

Second, with an https url, you have a credential helper caching mechanism which has likely cached (and will reuse automatically) your previous set of credential for pushing to github.com: you need to erase that credential from the cache.

On mac, this credential helper is libsecret.
See "Updating credentials from the OSX Keychain"

Then you will be requested to enter your kim2 GitHub credential when pushing, and they will be cached.

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

Edit global user.name and lobal user.email by edit ~/.gitconfig

[user] 
    email = your-email@xxx.com
    name = yourname

or

git config --global user.name "yourname"
git config --global user.email "your-email@xxx.com"

As you are using HTTPS rather than SSH, nothing to worry about authority problem.

As you had commit some patch by kim2, you should change this commit:

git commit --amend --author="author <your-email@xxx.com>"
jack guan
  • 331
  • 2
  • 12
0

vi ~/.gitconfig

Added in .gitconfig

[url "git@github.com:"] insteadOf = https://github.com/

Richard Lindhout
  • 2,038
  • 2
  • 23
  • 38
0

In my case, I was inviting new user to githup as a collaborator(if you don't know how to do that. You can follow this document here) after inviting the collaborator, I didn't accept the invitation from new user account. You should accept the invitation !!

Timur Turbil
  • 1,145
  • 10
  • 13