Git pushing to remote GitHub repository as wrong user

后端 未结 15 814
别跟我提以往
别跟我提以往 2020-11-30 17:49

I have a work GitHub account and a personal one. First I used the personal one for test projects, then I moved on and did a repository with the other account on the same com

相关标签:
15条回答
  • 2020-11-30 18:14

    I know this might be a little late, but I was stuck with this for quite some time and finally fixed it like this:

    example screenshot

    • Go into keychain access (osX)

    • search git (make sure you have selected All Items)

    • Here you will find the culprit credentials. Delete them.

    Hope this helps!

    0 讨论(0)
  • 2020-11-30 18:17

    I had the same problem. It turns out I had two accounts on GitHub using the same SSH key and GitHub defaulted to using the wrong account that did not have permission to the repo I was after. I removed the SSH key from the account I did not to use all worked as expected.

    You can test which account GitHub is authenticating yourself with:

    ssh -T git@github.com
    

    For me, this originally showed the wrong username, but after removing the duplicate SSH key from that account, it then showed the correct username and my pull and push to my repo worked well.

    0 讨论(0)
  • 2020-11-30 18:18

    I got the same issue. Below is what happen in my case:

    I previously made git to not ask my credential every time I talk with remote repository by this: git config --global credential.helper wincred

    I resolved the issue by running the same command with "none" replacing "wincred" git config --global credential.helper none

    Then git ask my username/pass again and everything go well

    0 讨论(0)
提交回复
热议问题