Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

⭐ If this helped you, give it a star!

πŸ’‘ A complete beginner-to-pro guide to manage multiple GitHub accounts using SSH without conflicts.

GitHub stars GitHub forks GitHub issues GitHub license Made With

πŸ”₯ Use Multiple GitHub Accounts on One System (Windows) Using SSH | Complete Guide

πŸš€ Struggling with multiple GitHub accounts on the same system?
This guide solves authentication conflicts, wrong commits, and SSH issues step-by-step.

⭐ Features

  • Supports multiple GitHub accounts on one system
  • Works on Windows (PowerShell)
  • No authentication conflicts
  • Clean and scalable setup

πŸ“Œ Why This Setup is Needed

When using multiple GitHub accounts on the same system, you may face:

  • Authentication conflicts
  • Wrong account commits
  • Push/pull permission issues

This setup solves these problems by:

  • Using separate SSH keys
  • Creating SSH aliases
  • Assigning identity per repository

Accounts Used

Type Email Username
Personal yashbelgahe99@gmail.com ycode99
Work yashwant@gmail.com yashwant

🧠 How It Works

Each GitHub account is mapped to a unique SSH key and alias:

  • github-personal β†’ Personal account
  • github-work β†’ Work account

This ensures Git uses the correct account automatically.

βš™οΈ Step 1: Generate SSH Keys

1.1 πŸ”ΉWork Account

ssh-keygen -t ed25519 -C "yashwant@gmail.com"

Save as:

C:\Users\yashq\.ssh\id_ed25519_work

My Image

1.2 πŸ”ΉPersonal Account

ssh-keygen -t ed25519 -C "yashbelgahe99@gmail.com"

Save as:

C:\Users\yashq\.ssh\id_ed25519_personal

My Image

βœ… Resulting Structure

C:\Users\yashq\.ssh\
β”œβ”€β”€ config
β”œβ”€β”€ id_ed25519_work
β”œβ”€β”€ id_ed25519_work.pub
β”œβ”€β”€ id_ed25519_personal
β”œβ”€β”€ id_ed25519_personal.pub

My Image

🧩 Step 2: Configure SSH

Create or edit the SSH config file:

Note: The SSH config file is typically located at:

C:\Users\yashq\.ssh\config

Add the following configuration:

# Work Account
Host github-work
  HostName github.com
  User git
  IdentityFile C:\Users\yashq\.ssh\id_ed25519_work

# Personal Account
Host github-personal
  HostName github.com
  User git
  IdentityFile C:\Users\yashq\.ssh\id_ed25519_personal

πŸ”— Step 3: Add SSH Keys to GitHub Accounts

3.1 Add SSH Keys to Work GitHub account

Open the terminal and run:

type C:\Users\yashq\.ssh\id_ed25519_work.pub

Enter:

Copy the work Key :

My Image

Add Keys to GitHub

  • Go to GitHub on browser β†’ Settings
  • Navigate to SSH and GPG Keys
  • Click New SSH Key
  • Paste the copied key
  • Save the key

My Image

3.2 Add SSH Keys to personal GitHub account

Note: follow same steps for Add SSH Keys to personal GitHub account:

Open the terminal and run:

type C:\Users\yashq\.ssh\id_ed25519_personal.pub

Enter:

Copy the Personal Key :

My Image

Add Keys to GitHub

  • Go to GitHub on browser β†’ Settings
  • Navigate to SSH and GPG Keys
  • Click New SSH Key
  • Paste the copied key
  • Save the key My Image

πŸ§ͺ Step 4: Test SSH Connection

Note: After adding the SSH keys to both accounts, run the following commands to verify the connection.

Go to Work account: Type:

ssh -T git@github-work

Output:

Hi <username>! You've successfully authenticated.

Go to Personal account: Type:

ssh -T git@github-personal

Output

Hi <username>! You've successfully authenticated.

πŸ“₯ Step 5: Clone Repositories

Format:

git clone git@<alias>:<username>/<repo>.git

Personal Repository:

git clone git@github-personal:ycode99/<repo-name>.git

Work Repository:

git clone git@github-work:yashwant/<repo-name>.git

πŸ‘€ Step 6: Set Git Identity (Per Repository)

Note: Git identity is required only when creating commits. It determines which account the commit will be attributed to.

Rule:

If no commit is created, Git identity is not required.

If you are committing changes, Git identity must be configured.

Work Repository:

git config user.name "Yashwant"
git config user.email "yashwant@gmail.com"

Personal Repository:

git config user.name "ycode99"
git config user.email "yashbelgahe99@gmail.com"

⚠️ Important Rules

❌ Do NOT use:

git@github.com:...

βœ… Always use:

github-work
github-personal

πŸ” Quick Debug Commands

git remote -v
git config user.email
ssh -T git@github-personal

🚨 Common Mistakes

  • Using default GitHub URL instead of SSH alias
  • Not setting Git identity before commit
  • Adding SSH key to the wrong account

πŸ–₯️ GitHub Desktop Note

GitHub Desktop:

  • Uses the logged-in account
  • Does not fully support SSH alias switching

πŸ‘‰ Recommended: Use VS Code + Terminal

πŸ“‚ Recommended Folder Structure

C:\Users\yashq\work\
C:\Users\yashq\personal\

βœ… Summary

This setup provides:

  • Secure SSH authentication
  • Correct commit attribution
  • Smooth multi-account workflow
  • Production-ready Git environment

πŸ‘¨β€πŸ’» Author

Yashwant Belgahe
Full Stack Developer | MERN | Data Science & AI | Embedded Systems

πŸ“§ yashbelgahe99@gmail.com

πŸ” Keywords

Multiple github accounts ssh windows, github ssh config multiple accounts, use two github accounts same pc, git ssh multiple users, github work personal setup


⭐ Support

If this helped you, please ⭐ star this repository β€” it helps others find it!

About

Step-by-step guide to manage multiple GitHub accounts on one system using SSH (Windows). Avoid conflicts and streamline your workflow.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors