xwartz / xwartz.github.com

Home Page
https://xwartz.github.com/
1 stars 0 forks source link

git 多账号切换 #13

Closed xwartz closed 7 years ago

xwartz commented 9 years ago
#create new SSH key:
cd ~/.ssh
ssh-keygen -t rsa -C "stddup@gmail.com"

# set alias id_rsa_xwartz
Enter file in which to save the key (/c/Users/Administrator/.ssh/id_rsa): id_rsa_xwartz

#add to SSH agent
ssh-add ~/.ssh/id_rsa_xwartz

#edit ~/.ssh/config

   Host xwartz.github.com
   HostName github.com
   User git
   IdentityFile ~/.ssh/id_rsa_xwartz

#add SSH key to github
~/.ssh/id_rsa_xwartz.pub

#check
ssh -T git@xwartz.github.com

配置之后

修改仓库的地址为相应的Host就好 repo/.git/config