একটি কম্পিউটারে Multiple GitHub Account ব্যবহার: Complete SSH Setup Guide
Hi, I am Full Stack Developer. I can build web application, android application, desktop application. My core programming language is JavaScript.
একই কম্পিউটারে যদি Personal, Office এবং Client—একাধিক GitHub account ব্যবহার করতে হয়, তখন authentication, push/pull এবং account switching নিয়ে সমস্যা হতে পারে।
সঠিকভাবে SSH Key + SSH Config + Project-specific Git Identity সেটআপ করলে একই PC, একই VS Code এবং একই Git installation ব্যবহার করেই একাধিক GitHub account আলাদাভাবে manage করা যায়।
এই পদ্ধতিকে সাধারণভাবে বলা হয়:
Multiple GitHub Accounts with SSH
আমরা কী তৈরি করব?
ধরি আমাদের তিনটি GitHub account আছে:
Personal GitHub
Work/Company GitHub
Client GitHub
আমরা এমন configuration তৈরি করব:
Personal Project
↓
github-personal
↓
Personal SSH Key
↓
Personal GitHub Account
Work Project
↓
github-work
↓
Work SSH Key
↓
Work GitHub Account
Client Project
↓
github-client
↓
Client SSH Key
↓
Client GitHub Account
একবার setup হয়ে গেলে project অনুযায়ী Git নিজেই সঠিক account/key ব্যবহার করবে।
1. কী কী লাগবে?
এই setup-এর জন্য লাগবে:
Windows 11
Git
Git Bash
VS Code
GitHub account(s)
প্রথমে Git installed আছে কিনা check করুন:
git --version
Version দেখালে Git installed আছে।
2. Existing Git Configuration Check
প্রথমে আপনার current Git configuration দেখুন:
git config --global user.name
git config --global user.email
এগুলো আপনার global Git identity দেখাবে।
এখানে একটি বিষয় মনে রাখা গুরুত্বপূর্ণ:
GitHub authentication এবং Git commit identity একই জিনিস নয়।
SSH key ঠিক করে কোন GitHub account-এ authenticate করবেন।
অন্যদিকে:
git config user.name
git config user.email
commit-এর author information নির্ধারণ করে।
3. SSH Directory তৈরি করা
Git Bash খুলে লিখুন:
mkdir -p ~/.ssh
তারপর:
cd ~/.ssh
বর্তমান files দেখুন:
ls
যদি আগে থেকেই SSH key থাকে, সেগুলো delete করবেন না।
4. Personal GitHub-এর জন্য SSH Key তৈরি
প্রথম account-এর জন্য:
ssh-keygen -t ed25519 -C "personal-email@example.com"
এখন Git আপনার কাছে key কোথায় save করবেন জানতে চাইবে:
Enter file in which to save the key:
এখানে লিখুন:
~/.ssh/id_ed25519_personal
এর ফলে দুটি file তৈরি হবে:
id_ed25519_personal
id_ed25519_personal.pub
এখানে:
id_ed25519_personal= Private keyid_ed25519_personal.pub= Public key
Private key কখনো কারও সাথে share করবেন না।
5. Work GitHub-এর জন্য SSH Key
দ্বিতীয় account-এর জন্য:
ssh-keygen -t ed25519 -C "work-email@example.com"
File name হিসেবে দিন:
~/.ssh/id_ed25519_work
তাহলে তৈরি হবে:
id_ed25519_work
id_ed25519_work.pub
6. Client GitHub-এর জন্য SSH Key
তৃতীয় account-এর জন্য:
ssh-keygen -t ed25519 -C "client-email@example.com"
File name:
~/.ssh/id_ed25519_client
এখন SSH folder মোটামুটি এমন হবে:
~/.ssh/
│
├── id_ed25519_personal
├── id_ed25519_personal.pub
│
├── id_ed25519_work
├── id_ed25519_work.pub
│
├── id_ed25519_client
└── id_ed25519_client.pub
7. SSH Agent চালু করা
Git Bash-এ:
eval "$(ssh-agent -s)"
এরপর তিনটি key add করুন:
ssh-add ~/.ssh/id_ed25519_personal
ssh-add ~/.ssh/id_ed25519_work
ssh-add ~/.ssh/id_ed25519_client
Check করতে:
ssh-add -l
তাহলে আপনার added SSH keys দেখতে পাবেন।
8. GitHub-এ Personal Public Key Add করা
Personal public key দেখতে:
cat ~/.ssh/id_ed25519_personal.pub
পুরো output copy করুন।
তারপর Personal GitHub account-এ যান:
GitHub → Settings → SSH and GPG keys → New SSH key
Title দিতে পারেন:
Windows 11 Personal PC
তারপর copied public key paste করে Add SSH key করুন।
9. Work Public Key Add করা
Work public key:
cat ~/.ssh/id_ed25519_work.pub
Output copy করুন।
তারপর Work GitHub account-এ:
Settings → SSH and GPG keys → New SSH key
Title:
Windows 11 Work PC
Public key paste করে save করুন।
10. Client Public Key Add করা
একইভাবে:
cat ~/.ssh/id_ed25519_client.pub
Output copy করুন।
Client GitHub account-এ গিয়ে:
Settings → SSH and GPG keys → New SSH key
তারপর key add করুন।
11. SSH Config তৈরি করা
এটাই পুরো setup-এর সবচেয়ে গুরুত্বপূর্ণ অংশ।
Git Bash-এ:
nano ~/.ssh/config
তারপর নিচের configuration দিন:
Host github-personal
HostName github.com
User git
IdentityFile ~/.ssh/id_ed25519_personal
IdentitiesOnly yes
Host github-work
HostName github.com
User git
IdentityFile ~/.ssh/id_ed25519_work
IdentitiesOnly yes
Host github-client
HostName github.com
User git
IdentityFile ~/.ssh/id_ed25519_client
IdentitiesOnly yes
Save করুন:
Ctrl + O
Enter
Ctrl + X
12. এই SSH Config কীভাবে কাজ করে?
আমরা GitHub-এর জন্য তিনটি custom SSH host তৈরি করেছি:
github-personal
github-work
github-client
SSH জানবে:
github-personal
↓
id_ed25519_personal
github-work
↓
id_ed25519_work
github-client
↓
id_ed25519_client
অর্থাৎ project অনুযায়ী আমরা শুধু hostname পরিবর্তন করব।
13. SSH Connection Test
Personal account test:
ssh -T git@github-personal
Work account:
ssh -T git@github-work
Client account:
ssh -T git@github-client
সবকিছু ঠিক থাকলে GitHub authentication successful হওয়ার message দেখতে পাবেন।
14. Personal Repository Clone করা
ধরি Personal GitHub-এ repository:
mahbub/personal-app
Normal GitHub URL-এর পরিবর্তে ব্যবহার করুন:
git clone git@github-personal:mahbub/personal-app.git
এখানে:
github-personal
বলছে Personal SSH key ব্যবহার করতে হবে।
15. Work Repository Clone করা
ধরি Work repository:
company/wms
Clone:
git clone git@github-work:company/wms.git
এবার Work SSH key automatically ব্যবহার হবে।
16. Client Repository Clone করা
Client repository:
client/project
Clone:
git clone git@github-client:client/project.git
এবার Client SSH key ব্যবহার হবে।
17. Existing Project-এর Remote Change করা
ধরি আগে থেকেই একটি project আছে:
cd my-project
Current remote দেখতে:
git remote -v
ধরি output:
git@github.com:company/project.git
এখন এটিকে Work account-এর সাথে connect করতে:
git remote set-url origin git@github-work:company/project.git
আবার check করুন:
git remote -v
এখন remote হবে:
git@github-work:company/project.git
18. Project-specific Git Username এবং Email
এখন আরেকটি গুরুত্বপূর্ণ বিষয়।
প্রতিটি project-এর জন্য আলাদা Git identity সেট করা ভালো।
Personal project:
git config user.name "Mahbubul Alam"
git config user.email "personal@example.com"
Work project:
git config user.name "Mahbubul Alam"
git config user.email "work@example.com"
Client project:
git config user.name "Mahbubul Alam"
git config user.email "client@example.com"
এখানে লক্ষ্য করুন:
আমরা --global ব্যবহার করছি না।
কারণ আমরা চাই:
Personal Project
→ Personal email
Work Project
→ Work email
Client Project
→ Client email
19. Current Project-এর Git Identity Check
যেকোনো project-এর ভিতরে:
git config user.name
এবং:
git config user.email
দিয়ে check করতে পারবেন।
Remote check:
git remote -v
20. Complete Personal Project Workflow
ধরি:
personal-app
Project folder-এ যান:
cd personal-app
Git identity:
git config user.name "Mahbubul Alam"
git config user.email "personal@example.com"
Remote:
git remote set-url origin git@github-personal:mahbub/personal-app.git
তারপর normal Git workflow:
git add .
git commit -m "Update application"
git push
Push করার সময় Personal SSH key ব্যবহার হবে।
21. Complete Work Project Workflow
Work project:
cd company-wms
Git identity:
git config user.name "Mahbubul Alam"
git config user.email "work@example.com"
Remote:
git remote set-url origin git@github-work:company/company-wms.git
তারপর:
git add .
git commit -m "Update WMS"
git push
এবার Work GitHub account ব্যবহার হবে।
22. VS Code-এর ক্ষেত্রে কী হবে?
VS Code-এ আলাদা কোনো special configuration সাধারণত প্রয়োজন নেই।
আপনি project open করবেন:
code .
তারপর VS Code-এর integrated terminal থেকেই:
git add .
git commit -m "Update"
git push
করতে পারবেন।
SSH configuration system-level হওয়ায় VS Code একই configuration ব্যবহার করবে।
23. Recommended Folder Structure
একটি clean development setup এমন হতে পারে:
D:\Projects\
│
├── personal\
│ ├── portfolio
│ ├── ecommerce
│ └── mobile-app
│
├── work\
│ ├── wms
│ ├── erp
│ └── lead-management
│
└── clients\
├── client-a
├── client-b
└── client-c
প্রতিটি project তার নিজের GitHub account/repository-এর সাথে connected থাকবে।
24. সবচেয়ে গুরুত্বপূর্ণ পার্থক্য
Multiple GitHub account setup করার সময় দুটি জিনিস আলাদা করে বুঝতে হবে।
SSH Authentication
SSH Key
↓
GitHub Account
এটি নির্ধারণ করে:
কোন GitHub account হিসেবে authenticate করছি?
Git Commit Identity
git config user.name
git config user.email
এটি নির্ধারণ করে:
Commit-এর author হিসেবে কোন নাম/email থাকবে?
দুটিকে এক মনে করলে অনেক সময় confusion হয়।
25. Final Architecture
পুরো system-টা এভাবে কাজ করবে:
Git Project
│
▼
Git Remote
│
┌──────────┼──────────┐
│ │ │
▼ ▼ ▼
github-personal github-work github-client
│ │ │
▼ ▼ ▼
Personal Key Work Key Client Key
│ │ │
▼ ▼ ▼
Personal Work Client
GitHub GitHub GitHub
আর project-এর ভিতরে:
Project
│
├── Git Remote
│ ↓
│ GitHub Account
│
└── Git Identity
↓
name + email
26. Daily Development Workflow
একবার setup হয়ে গেলে প্রতিদিনের কাজ খুব সহজ।
Personal Project
cd personal-project
git pull
কাজ করুন।
তারপর:
git add .
git commit -m "Update feature"
git push
Work Project
cd work-project
git pull
কাজ করুন।
তারপর:
git add .
git commit -m "Implement feature"
git push
কোনো account manually logout/login করার প্রয়োজন নেই।
27. কেন SSH ব্যবহার করা ভালো?
Multiple GitHub account-এর ক্ষেত্রে SSH ব্যবহার করলে:
বারবার username/password দিতে হয় না
Personal/Work/Client আলাদা রাখা যায়
Project অনুযায়ী key automatically select করা যায়
VS Code-এর সাথে সহজে কাজ করে
Git Bash এবং terminal workflow clean থাকে
এক PC-তে অনেক GitHub account manage করা যায়
28. Common Mistakes
Mistake 1: সব account-এর জন্য একই SSH key ব্যবহার করা
এটা avoid করা ভালো।
বরং:
Personal → Personal key
Work → Work key
Client → Client key
রাখুন।
Mistake 2: git@github.com ব্যবহার করা
Multiple account setup করার পরে repository URL-এ সাধারণত:
git@github.com
এর পরিবর্তে ব্যবহার করবেন:
git@github-personal
অথবা:
git@github-work
অথবা:
git@github-client
Mistake 3: Global email দিয়ে সব project চালানো
এতে সব repository-এর commit একই email দিয়ে তৈরি হতে পারে।
তাই account-specific project-এ:
git config user.email "..."
ব্যবহার করুন।
Mistake 4: Private key share করা
এই file কখনো share করবেন না:
id_ed25519_personal
id_ed25519_work
id_ed25519_client
শুধু .pub file-এর public key GitHub-এ add করবেন।
29. Quick Cheat Sheet
SSH keys
ssh-keygen -t ed25519 -C "email@example.com"
Add key
ssh-add ~/.ssh/id_ed25519_personal
Test
ssh -T git@github-personal
Set project identity
git config user.name "Your Name"
git config user.email "email@example.com"
Change remote
git remote set-url origin git@github-work:username/repository.git
Check remote
git remote -v
Check identity
git config user.name
git config user.email
Conclusion
একটি computer-এ multiple GitHub account ব্যবহার করার সবচেয়ে clean approach হলো:
Multiple GitHub Accounts
+
Multiple SSH Keys
+
SSH Config
+
Project-specific Git Identity
একবার setup সম্পন্ন করার পর Personal, Company এবং Client project-এর মধ্যে account switching করার জন্য বারবার GitHub logout/login করতে হবে না।
প্রতিটি project তার নির্দিষ্ট SSH host-এর মাধ্যমে নির্দিষ্ট GitHub account ব্যবহার করবে।
সবচেয়ে গুরুত্বপূর্ণ concept:
Personal Project
→ github-personal
→ Personal SSH Key
→ Personal GitHub
Work Project
→ github-work
→ Work SSH Key
→ Work GitHub
Client Project
→ github-client
→ Client SSH Key
→ Client GitHub
এভাবেই একটি Windows PC থেকে professionalভাবে একাধিক GitHub account এবং অসংখ্য project manage করা যায়।

