1 生成公钥
1. 安装git,从C:Documents and SettingsAdministrator.ssh目录打开 "Git Bash";
2. 键入命令:ssh-keygen -t rsa -C "email@email.com","email@email.com"是github账号;
3. 提醒你输入key的名称,输入如id_rsa_githubName;
4. 在C:Documents and SettingsAdministrator下产生两个文件:id_rsa_githubName和id_rsa_githubName.pub;
2 添加公钥到某个github账号
用记事本打开id_rsa.pub文件,复制内容,在github.com的网站上到ssh密钥管理页面,添加新公钥,随便取个名字,内容粘贴刚才复制的内容;
3 在C:Documents and SettingsAdministrator.ssh目录配置文件config
#personal account
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa
#work account
Host github.com-work
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_githubName
4 用ssh访问github
git clone git@github.com-work:socialchorus/repo_name.git