0

I have --global git config under ~/.gitconfig

has email1

and

I also have --local git config under a git repo's .git/config

has email2

Both have different emails.

Now when I push to my remote repo from under the repo clone that has --local config I get an error saying "remote: Permission to abc/def.git denied to email1."

Why so and how can I fix this ?

I am using https github url's so don't have ssh keys set up or added to github.

git config --get user.email

shows email2 when run under the clone of remote repo.

shows email1 when run from my ubuntu home directory

git config --get-all user.email

shows both email1 and email2 when run under the clone of remote repo.

shows email1 when run from my ubuntu home directory

4
  • Which email does git config --get user.email show? what about git config --get-all user.email? Commented Mar 8, 2017 at 22:56
  • @llion Post updated with answer to your question. Commented Mar 8, 2017 at 23:00
  • 1
    Does git config --get github.user show anything? Do you know if you have a credential helper setup? Heck maybe just do git config -l and see what turns up. Commented Mar 8, 2017 at 23:19
  • 1
    Yes you are right. After I invalidated the credential helper cache, things started working fine. I just figured this out myself. If you make an answer out of your comment I will accept it. Thanks Commented Mar 8, 2017 at 23:47

1 Answer 1

1

It's likely that you have credentials stored in your credential helper. You should try invalidating them. You can also review all your current config settings with the command:

git config -l
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.