visual-studiogithubvisual-studio-2022git-commit

GitHub ghost users as commits when using Source Control in Visual Studio 2022


I'm using Visual Studio 2022 Community.

I have only used Source Control in Visual Studio once. I decided to use it again, following this tutorial.

I created a simple solution that has nothing but Hello World console app. I clicked Add to Source Control then Git. I made sure to sign in via GitHub to Visual Studio. Here are the settings: "Create a Git repository" window in Visual Studio 2022

So I clicked Create & Push. I look at my GitHub profile, and yes, the repository has been created.

However, when I look at the commits after creating the repository, they don't have a user profile and are all titled "User", suggesting that those are ghost users: Commits after creating the repository in VS

Then I decided to create a new file named TextFile.txt directly via the github.com website. It works, and I also see my profile picture and username displayed in the commit:

My commit when I directly created a file via github.com

Can anyone explain why the commits are broken when I use Visual Studio 2022 even though I signed in to Visual Studio via my GitHub account, but they aren't when I commit/change a file/add a file directly via github.com?

Any help would be appreciated.

I was not able to find anything like this on the internet.


Solution

  • Your observation can be reproduced by configuring git to use the username "User".

    Use git config --list to view your current settings.

    Use the cli to change your settings

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

    Github documents the need to configure git here.

    Use the Visual Studio UI to change the settings

    enter image description here

    These values can be overwritten in your repository settings.