gitgithubgit-commitgit-pushgithub-for-mac

git push linked to the wrong/with two accounts


I am using a Laptop that they handed down to me at my internship, when I go to push, it was pushing with a different account. Even though I signed in and got authenticated when I pushed. (I also removed keychain password from mac) enter image description here

As you can see the 'first' is my account, the others even though I signed in and got authenticated are not my github account, but has the same username.

I tried this method of committing after looking around

git commit --author='name <email>' -m '...'

but this ended up causing this: enter image description here

I then tried this command:

git config --global --unset-all user.name

And when I go to push it pushed with this, the person that owned the laptop originally... enter image description here


Solution

  • You are missing the --global argument. Try following the steps below:

    Open Terminal.

    git config --global user.email "email@example.com" 
    
    git config --global user.name "Your Name" 
    

    Confirm that you have set the email address correctly in Git:

    git config --global user.email
    
    git config --global user.name
    

    Add the email address to your GitHub account by setting your commit email address on GitHub, so that your commits are attributed to you and appear in your contributions graph.