8

I am using github on windows. I am new at github, so I am a bit confused about accouts. I set up github some times ago (4 months). And I have two github account on github.com

  • username1, myemail1@domain.com
  • username2, myemail2@domain.com

I am creating a repository on github.com with username1 account. Repository name is test. And I am pushing my files to repository. commands:

  • git remote add github git@github.com:username1/test.git
  • git push origin master

And I am opening my github username1 account on github.com web site, and opening tets repository page, but index content modified by username2

I changed username, email from console but username2 is appearing yet.

Is it about ssh? What can I do? I am new.

imbric
  • 114
  • 1
  • 12
barteloma
  • 6,403
  • 14
  • 79
  • 173

2 Answers2

7

The GitHub user account which owns a particular repository can be different from the user that makes commits. (You can make commits in someone else's repository if they give you permission, right?).

My bet is that your local user (which makes commits) is username2. You're able to make commits on a repo owned by username1 because you have authorization to do so (you own it ).

You can check what your local git configuration is using for a username by either

a) Running git config --global --list OR b) Opening ~/.gitconfig in an editor.

To update your global user name (applies for future commits in ALL local repositories) run, git config --global user.name <username>.

I can see what the next question is going to be: "What if I want my local git user to change depending on which repository is checked out?" You need to add git configurations per repository. In your repo run git config user.name <username> (Note the absence of the global flag). You might also want to add git config user.email <email> or any other repo specific settings you want.

imbric
  • 114
  • 1
  • 12
1

Besides @imbric's answer about setting user.name and user.email with config --global, you might also have to delete the Windows credential associated with your old Github account.

This thread provides instructions for deleting the credential.

Nigel Gilbert
  • 439
  • 5
  • 5