Warm tip: This article is reproduced from stackoverflow.com, please click
git github visual-studio

Commiting changes to Github repository with Visual Studio commits with wrong author

发布于 2020-04-07 10:14:47

I have recently added source control to my project but when I commit changes the author appears to be a user that has no relation to the repository. However its name is my Microsoft account’s Username. I have tried changing the config for git , also changing repo setting in visual studio. Nothing works

How can I start commiting and showing with my GitHub Username?

Note: I also have enabled signing commits

git config --list run at C:\

http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
http.sslbackend=openssl
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
credential.helper=manager
core.editor="C:\\Program Files (x86)\\Notepad++\\notepad++.exe" -multiInst 
-notabbar -nosession -noPlugin
core.autocrlf=true
core.fscache=true
core.symlinks=true
winupdater.recentlyseenversion=2.25.0.windows.1
user.name=ProgrammerDim
user.email=dimitritouli@gmail.com
user.signingkey=994CC457AE529B51
gpg.program=C:\Program Files\Git\usr\bin\gpg.exe

git config --list run at repo

http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
http.sslbackend=openssl
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
credential.helper=manager
core.editor="C:\\Program Files (x86)\\Notepad++\\notepad++.exe" -multiInst -notabbar -nosession -noPlugin
core.autocrlf=true
core.fscache=true
core.symlinks=true
winupdater.recentlyseenversion=2.25.0.windows.1
user.name=ProgrammerDim
user.email=dimitritouli@gmail.com
user.signingkey=994CC457AE529B51
gpg.program=C:\Program Files\Git\usr\bin\gpg.exe
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
Questioner
Dimitris Toulis
Viewed
75
CodeRunner 2020-02-01 00:26

Most probably your user is not correctly configured in your local git setting and that's why your seeing different username when you commit.

Use following commands to set the global username & email id for git

$ git config --global user.email "email@example.com"
$ git config --global user.name "your-user-name"

If you just want to set it to particular repository then

  1. Open Git Bash.

  2. Change the current working directory to the local repository where you want to configure the email address that you associate with your Git commits.

  3. Set an email address in Git. You can use your GitHub-provided no-reply email address or any email address.

    $ git config user.email "email@example.com"

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

    $ git config user.email email@example.com

Follow this article to for more details