DEV Community

keshav Sandhu
keshav Sandhu

Posted on

1

How to Use Multiple GitHub Accounts Without SSH on Windows (Using Windows Credentials Manager)

Managing multiple GitHub accounts on Windows can be tricky, especially when dealing with credentials. Here's a step-by-step guide to handle this efficiently using Windows Credential Manager and project-specific configurations.


Step 1: Remove Existing GitHub Credentials

Before starting, clear any saved GitHub credentials to avoid conflicts:

  1. Open Control PanelCredential Manager.
  2. Switch to the Windows Credentials tab.
  3. Look for entries like git:https://github.com and remove them.

This ensures a clean slate for adding new credentials.


Step 2: Configure Git Username and Password for a Specific Project

To associate a GitHub account with a specific project:

  1. Navigate to your project's .git folder (ensure hidden files are visible).
  2. Open the config file in a text editor.
  3. Add the following under the [remote "origin"] section:
   [remote "origin"]
       url = https://your-username:your-personal-access-token@github.com/your-repo-name.git
Enter fullscreen mode Exit fullscreen mode

Replace:

  • your-username with your GitHub username.
  • your-personal-access-token with your Personal Access Token (PAT).
  • your-repo-name with your repository's path.
  1. Save the file.

This stores credentials for that specific project and prevents Git from asking for authentication each time.


Step 3: Use Another GitHub Account in a Different Project

For other projects, simply clone or initialize the repository as usual. When you push or pull, Git will prompt you to log in via your browser.


Step 4: Switching Between Accounts

After setting up multiple accounts:

  • First Project: Credentials saved in the config file will be used automatically.
  • Other Projects: Git will prompt you to select or enter credentials. To avoid repeated prompts, repeat Step 2 for each project with the desired account.

Step 5: Removing Project-Specific Credentials

If you want to remove or update credentials for a project:

  1. Open the .git/config file.
  2. Remove or modify the url under [remote "origin"].

Step 6: Generating a Personal Access Token (PAT)

GitHub now requires a Personal Access Token instead of a password. Here’s how to generate one:

  1. Go to your GitHub ProfileSettings.
  2. Navigate to Developer SettingsPersonal Access TokensTokens (classic).
  3. Click Generate New Token and select the required scopes (e.g., repo, workflow).
  4. Copy the token and use it as the password in Step 2.

Final Notes

  • This method ensures smooth switching between multiple GitHub accounts without SSH.
  • Be cautious about storing credentials in the URL; only do so for non-sensitive projects.

Sentry blog image

How I fixed 20 seconds of lag for every user in just 20 minutes.

Our AI agent was running 10-20 seconds slower than it should, impacting both our own developers and our early adopters. See how I used Sentry Profiling to fix it in record time.

Read more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay