Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 976
James Avatar asked Jul 10 '19 11:07

James


People also ask

How do you switch accounts in VS Code?

In VS Code press Ctrl + Shift + p to see the command palette and write the symbol > , after that you can see any command you need including the sign out command to work with this extension.


1 Answers

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.

like image 108
James Avatar answered Oct 10 '22 02:10

James