James
James

Reputation: 461

How Do I Change The User In VSCode and Link My Github Account?

I'm using someone else's laptop with vscode, and while I'm able to push to my github repos, it comes up under their name which makes my github account look inactive.

The integrated terminal in VSCode looks like: Bob's Macbook:(directory name) Bob

Therefore, when I push to my repos, it appears as if Bob is making commits to my repos when it's actually me. As a result, my 'recent activity' chart on my profile doesn't look like I've been committing, which isn't ideal.

I couldn't find where to change the user in VSCode settings, so I figured I'd post it here in case someone ran into the same issue.

How do I get my github username connected to my VSCode terminal?

Upvotes: 8

Views: 17276

Answers (2)

Virath
Virath

Reputation: 21

I'm on a mac and I did

git config --global user.email [email protected]

git config --global user.name example.user

I also had to remove github from my keychain

Upvotes: 2

James
James

Reputation: 461

I found an article on github that answered my question. There's just two easy steps in the setting your commit email in git section.

All you have to do is first run:

git config --global user.email "[email protected]"

Don't use quotation marks, just put your desired email in and make sure it's associated with your github account (Github > Profile > Settings > Email > Add Email)

Then check to see if it worked with:

git config --global user.email

Which should return your email. You'll see your next commit in your profile.

As mentioned in the comments below, you should also run that command with user.name to change the name attached to the commit.

Upvotes: 11

Related Questions