1

Initially my git was logged in to abc@gmail.com Later I want to push my new code to repository to email xyz@gmail.com

Trying to push my android code on github.

All the steps are going fine. Now when last when I do this :

git push origin master

It shows :

remote: Permission to ****/******.git denied to xyz@gmail.com.
fatal: unable to access 'https://github.com/*********/ScanFiles.git/': The requested URL returned error: 403

But when I do : git config --global user.email It shows xyc@gmail.com.

What is the problem?

Parth Anjaria
  • 3,961
  • 3
  • 30
  • 62

1 Answers1

1

Git doesn't care what you put in the user name and email address fields. You can call yourself whatever you like. When you run git push, though, you have your Git call up some other Git on some other computer or web site—some other machine, anyway, and that other machine requires that you authenticate yourself to that machine before that machine will run its Git.

It's this step—the authentication of yourself as yourself—that is failing. Git is not yet involved! Once you solve that problem, then you can worry about whether the Git on that system believes you when you claim to be Barack Obama or whoever; that's a separate issue.

Since you are using GitHub, you may wish to start with GitHub's help page on authentication. You might also read this answer on credential helpers and Why does GitHub recommend HTTPS over SSH? (which notes that GitHub themselves have waffled over whether to prefer ssh or https).

torek
  • 448,244
  • 59
  • 642
  • 775