barteloma
barteloma

Reputation: 6845

github account changing on windows

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

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

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.

Upvotes: 8

Views: 20583

Answers (2)

Nigel Gilbert
Nigel Gilbert

Reputation: 509

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.

Upvotes: 2

imbric
imbric

Reputation: 144

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.

Upvotes: 9

Related Questions