I've posted this as an issue on the GitHub repository for the Desktop app, but I just wanted to check if anyone else has experienced this too.
In the GitHub Desktop GUI, when you log off from user A, then log on with user B, the new commits you make through the Desktop GUI will be registered as having been made by user A (not B).
I expect the most recent commit to "Repository Y" to be registered to "User B", since the GitHub Desktop GUI was logged in to "User B" when the commits were made.
Instead, "Repository Y"'s online repository will state that the most recent commit was made by "User A" , not "User B". This is likely due to some left-over authentication files that don't get cleared out when we log out of the GitHub Desktop GUI.
I'm using GitHub Desktop 2.9.6 (x64) on Windows 10.
If you can't replicate this bug, try erasing the files in the %APP_DATA%\GitHub Desktop
folder (typically, C:\Users\your_username\AppData\Roaming\GitHub Desktop
) before starting with Steps 1 through 17. But please back up your files before you do this!!!!
Also, be sure to actually use two separate GitHub accounts but just one Windows user.
How can I ensure that the commits I make with the GitHub Desktop app after logging off from "User A" and logging into "User B" actually get registered as having been made by "User B" (not "User A")?
My current solution is to just delete the whole %APPDATA%\GitHub Desktop
folder. But that's a huge pain because I loose ALL of the information about the repositories that are currently on my machine and have to re-add them, one by one.
The account you use to push to GitHub is not necessarily related to the information that's in your commits. GitHub associates a commit with an account by the email in the commit, which is set with user.email
. Usually that value is set in the Git configuration and not by GitHub Desktop, although it's possible that you could configure GitHub Desktop to override it.
If you want to configure different user information for a particular repository, you can set user.name
(which is a personal name, not a username) and user.email
with git config user.email MY-EMAIL
(respectively user.name
) in the repository.
Note that the authentication is irrelevant here because it's completely valid to push commits to a repository that were created by someone else. The authentication information is completely different from what's in your commits, and it's the latter that matters in this case.