VSCode commits dont use my actual github account and instead rely on user.name and email

Viewed 281

Today I reinstalled Windows10 and added Git and Visual Studio Code(vscode). The problem is first I initialized the github repository then then I send commits and push then vscode asks me to set user.name and user.email. This is a problem because I want vscode to use my github account. I tried setting github.token and user.token but both had no effect.

How can I fix this, is vscode broken? When I set user.name and email it does send commits and pushes them but in the repos commits it only shows the name and it isn't a valid user. Then clicking it, well you cant because it isn't from a real github account.

Any help is appreciated!

After some googling I found out that this is called a local account which is used by git to make commits faster. Also is there a way for me to disable local github accounts on my organization so I know who is sending commits.

I still cant find a way to use github accounts instead of local accounts.

1 Answers

You should install GitHub CLI.
In your local repository root: First, log in to GitHub:

gh auth login

Then, create a remote repository:

gh repo create

After some commits, you can:

git push

And the remote repo will be synced to the local one.

Related