మీకు 2 GitHub Accounts ఉన్నాయి:
siddhuphp (Personal Account)
Siddhartha-Esunuri_mmsrx (Office/Work Account)
ఇప్పుడు Git SSH ద్వారా connect అవుతున్నప్పుడు GitHub కి:
నేను Siddhartha-Esunuri_mmsrx account ని
అని చెబుతోంది.
అందుకే siddhuphp/bhoomatha private repo access చేయలేక:
Repository not found
అని వస్తోంది.
Visual Understanding
మీ దగ్గర రెండు ఇళ్ళు ఉన్నాయని అనుకోండి:
🏠 House A = siddhuphp
🔑 Key A
🏢 House B = Siddhartha-Esunuri_mmsrx
🔑 Key B
ప్రస్తుతం Git దగ్గర:
🔑 Key B
మాత్రమే ఉంది.
కానీ మీరు open చేయాలనుకుంటున్నది:
🏠 House A (siddhuphp)
అందుకే door open అవ్వడం లేదు.
Step 1: రెండు SSH Keys ఉండాలి
ప్రస్తుతం check చేయండి:
ls ~/.ssh
ఉదాహరణ:
id_ed25519
id_ed25519.pub
ఇది ప్రస్తుతం Office account key అయి ఉండవచ్చు.
Step 2: Personal Account కోసం కొత్త Key Create చేయండి
ssh-keygen -t ed25519 -C "siddhu.php@gmail.com" -f ~/.ssh/id_ed25519_siddhuphp
తర్వాత:
~/.ssh/id_ed25519_siddhuphp
~/.ssh/id_ed25519_siddhuphp.pub
create అవుతాయి.
Step 3: GitHub లో Add చేయండి
Public key చూడండి:
cat ~/.ssh/id_ed25519_siddhuphp.pub
Output:
ssh-ed25519 AAAAXXXXXXX....
మొత్తం copy చేయండి.
తర్వాత:
GitHub (siddhuphp account)
➡ Settings
➡ SSH and GPG Keys
➡ New SSH Key
➡ Paste
Step 4: SSH Config File
File:
C:\Users\Siddhartha\.ssh\config
Create చేయండి.
లోపల:
Host github-personal
HostName github.com
User git
IdentityFile ~/.ssh/id_ed25519_siddhuphp
Host github-office
HostName github.com
User git
IdentityFile ~/.ssh/id_ed25519
Visual Map
github-personal
|
|
+----> id_ed25519_siddhuphp
|
|
+----> siddhuphp Account
github-office
|
|
+----> id_ed25519
|
|
+----> Siddhartha-Esunuri_mmsrx Account
Step 5: Test
Personal
ssh -T git@github-personal
Output:
Hi siddhuphp!
Office
ssh -T git@github-office
Output:
Hi Siddhartha-Esunuri_mmsrx!
Step 6: Clone
Personal Repo
❌ ఇలా కాదు
git clone git@github.com:siddhuphp/bhoomatha.git
✅ ఇలా
git clone git@github-personal:siddhuphp/bhoomatha.git
Office Repo
git clone git@github-office:company/project.git
Future Usage
మీరు Personal Project (VizagUpdates, Bhoomatha, etc.) లో:
git config user.name "siddhuphp"
git config user.email "siddhu.php@gmail.com"
Office Project (inspiredge, amzut, etc.) లో:
git config user.name "Siddhartha-Esunuri_mmsrz"
git config user.email "Siddhartha.Esunuri@office.com"
ముందుగా ఈ command output పంపండి:
ls ~/.ssh
అప్పుడు మీ machine లో ప్రస్తుతం ఏ keys ఉన్నాయో చూసి exact config file నేను మీకు తయారు చేసి ఇస్తాను.
Comments
Post a Comment
Thank you :)