- from cmd prompt go to c:/users/xyz/mkdir .ssh
- open gitbash from c:/program files/git/bin/bash.exe
- type
ssh-keygen -t rsa -C "your-email-address"
- Enter full path when asked for the file name (this is important)
C:/Users/xyz/.ssh/id_rsa_ge
- Enter pass phrase..and your key shall be generated.
- Login to your Github account “SSH and GPG keys” click New SSH Key button
- Open your id_rsa_ge.pub file in a text file eg notepad and copy everything and paste into the key dialog..give any title of your choice.
- In git bash Type
ssh-add ~/.ssh/id_rsa_ge
- If it says “Could not open a connection to your authentication agent.”, do the following commands a. ssh-agent b. $ eval $(ssh-agent)
it should return a agent pid Now again repeat step 8.
Create config file in .ssh folder and type
#Default GitHub
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa
Host github-ge
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_ge
Now use git
git add .
git commit ...
git push origin master
Note: before reinstalling your OS always take a backup of keys