If you are using Visual Studio Code (VS Code) for development, you probably connect it with GitHub to manage and push your projects. However, sometimes you may need to change the GitHub account connected to your projects.




This situation is common when you create a new GitHub account, manage multiple accounts, or transfer projects to another profile.

In this guide, you will learn how to completely change the GitHub account in VS Code on Windows in a simple and safe way.


🔄 Why You Might Need to Change Your GitHub Account

There are several common reasons developers switch GitHub accounts:

  • ✔ You created a new GitHub account for development
  • ✔ You want to separate personal and professional projects
  • ✔ You are facing authentication errors while pushing code
  • ✔ You moved your repository to another GitHub account

Regardless of the reason, the process is straightforward if you follow the steps carefully.


1 Sign Out of GitHub in VS Code

First, disconnect the currently signed-in GitHub account from VS Code.

Method 1: Using the Accounts Icon

  1. Open Visual Studio Code
  2. Look at the bottom-left corner
  3. Click the Accounts icon (person silhouette)
  4. Select Sign Out next to GitHub

Method 2: Using the Command Palette

  1. Press Ctrl + Shift + P
  2. Search for Sign Out
  3. Select Sign Out of GitHub

This will disconnect the current GitHub account from VS Code.


2 Remove Old GitHub Credentials from Windows

Windows stores GitHub credentials, and sometimes VS Code automatically logs in using saved credentials. To avoid this, remove the old credentials.

⚠ Important: If you skip this step, VS Code may automatically reconnect to the old account using saved Windows credentials.

Follow these steps:

  1. Open the Start Menu
  2. Search for Credential Manager
  3. Click Windows Credential Manager
  4. Open Windows Credentials
  5. Look for entries such as:
    • git:https://github.com
    • github.com
  6. Click each entry and select Remove

This ensures that the previous account information is completely removed from your system.





3 Configure Git With Your New Account

Now you need to update Git with your new username and email. Open the VS Code terminal (Ctrl + `) and run the following commands:

git config --global user.name "Your New Username"
git config --global user.email "your-new-email@example.com"

For example:

git config --global user.name "Aio Crafters"
git config --global user.email "aiocrafters@gmail.com"

These commands set the global Git identity that will be used for all future commits.

Verify Your Configuration

To confirm the configuration has been updated correctly, run:

git config --global --list

You should see output like:

user.name=Aio Crafters
user.email=aiocrafters@gmail.com

💡 Tip: If you work on multiple projects with different accounts, you can use local Git configuration instead of global. Navigate to the project folder and run the same commands without the --global flag to set the identity only for that specific repository.


4 Sign In With the New GitHub Account

Now connect VS Code to your new GitHub account.

  1. Press Ctrl + Shift + P to open the Command Palette
  2. Search for GitHub: Sign In
  3. Click the option
  4. Your browser will open automatically
  5. Log in with your new GitHub account
  6. Authorize Visual Studio Code

Once completed, VS Code will be connected to your new GitHub account. You can verify by checking the Accounts icon in the bottom-left corner — it should now display your new account name.


5 Update the Repository Remote URL (If Needed)

If your project was connected to the old GitHub account's repository, you must update the remote URL to point to the new account.

Check the Current Remote Repository

Run the following command in the VS Code terminal:

git remote -v

This will show the current remote URLs. If they point to your old account, update them.

Change the Remote URL

git remote set-url origin https://github.com/YOUR-USERNAME/YOUR-REPOSITORY.git

For example:

git remote set-url origin https://github.com/aiocrafters/myproject.git

Now your project will push code to the repository under the new GitHub account.

💡 Tip: After updating the remote URL, run git remote -v again to confirm the change was applied successfully.


📋 Quick Reference Summary

Here's a concise overview of all the steps:

Step Action
Step 1 Sign out of GitHub in VS Code
Step 2 Remove old credentials from Windows Credential Manager
Step 3 Configure Git with new username and email
Step 4 Sign in with the new GitHub account
Step 5 Update the remote repository URL (if needed)

🔑 Pro Tip: If you frequently switch between GitHub accounts, consider using SSH keys for multiple GitHub accounts. This allows you to manage several accounts on the same machine without repeatedly logging in and out. You can configure separate SSH keys for each account and use SSH config to route requests appropriately.


✅ Final Thoughts

Changing the GitHub account in VS Code is simple when you follow the correct process. The key steps include signing out of the old account, removing saved credentials, updating Git configuration, and signing in with the new account.

Once completed, you will be able to push, pull, and manage repositories using your new GitHub account without any authentication issues.

If you manage multiple projects or accounts, keeping your Git configuration updated will help avoid many common development problems.


By keeping your development environment properly configured, you ensure a smooth and productive workflow every time you code.