git pushes with wrong user from terminal

前端 未结 22 1449
夕颜
夕颜 2020-12-07 07:51

I have an issue with git and my terminal.

Here\'s a gallery to show you my issue : http://imgur.com/a/6RrEY

When I push commits from my terminal, git says I

22条回答
  •  执笔经年
    2020-12-07 07:53

    What a pain in the butt!

    problem:

    1. create a repo on git hub
    2. clone to local machine
    3. can not push 403.

    turns for unknow reason git push was using the wrong user. I have a couple of different git hub user ids. I work for 2 different companies and also have a student id

    I am working on a mac. here is what I finally did

    1) remove the credential.helper

    • some how the credential helper got set to osxkeychain
    • when I started keychain, click on login, passwords and searched for github I found 3 entries. I have no idea how keychain could possible know which one to use

    a. you need to figure out where the credential.helper is configured

    git config --local credential.helper
    git config --global credential.helper
    git config --system credential.helper
    

    b. once find the correct fig file remove it as follows

    git config --global --unset credential.helper
    

    Now in my local repo I hacked the .git/config file

    I changed

        url = https://github.com/aedavids/lab3RotationProject.git
    

    to

        url = https://myGitHubUserId@github.com/aedavids/lab3RotationProject.git
    

提交回复
热议问题