笔者偏在阿里云,Github,开源中国上均存放一些私有项目代码,因此需要再Windows电脑上配置多个SSH Key

环境

  1. 操作系统:windows 7
  2. Git

提示:Git 安装后就可以使用 Git bash ,接下来的命令都在 Git bash 中输入和执行

  1. 注册好 Github 账号,其中 Email 为 987654321@qq.com
  2. 用支付宝/淘宝账号登录 https://code.aliyun.com ,在设置->个人设置页面看到邮箱为 987654321@163.com

Github

1.打开 Git bash

2.输入命令

ssh-keygen -t rsa -C "987654321@qq.com"

3.执行结果

4.拷贝公钥

  • 方法一:在 Git Bash 中输入命令拷贝文件内容到剪切板:
clip < ~/.ssh/id_rsa_github.pub
  • 方法二:从文件中拷贝

    进入 C:\Users\{你的用户名}.ssh\ ,用记事本打开 id_rsa_github.pub,拷贝文件中所有内容

5.添加复制的公钥到 Github 中

  • 首先,登录 https://www.github.com ,在右上角打开弹出框,选择 Settings

  • SSH and GPG keys 打开 New SSH Key

  • 粘贴剪切板中公钥并 Add SSH Key:

6.在 .ssh 目录下创建 config 配置文件



输入以下配置信息:

# 配置github 的key
Host github.com
HostName github.com
User git
IdentityFile C:\Users\Administrator\.ssh\id_rsa_github

7.命令测试:

ssh -T git@github.com

阿里云

1.在 Git bash 输入命令

ssh-keygen -t rsa -C "987654321@163.com"

2.执行结果

3.拷贝公钥

  • 方法和 Github 中相同,目标文件变为 id_rsa_aliyun_code.pub

4.新增 SSH 公钥

5.编辑 config

新增以下信息

# 配置 code.aliyun 的 key
Host code.aliyun.com
HostName code.aliyun.com
User git
IdentityFile C:\Users\Administrator\.ssh\id_rsa_aliyun_code

6.测试

ssh -T git@code.aliyun.com

参考博客

  1. 同一台电脑关于多个SSH KEY管理

  2. Windows下Git多账号配置,同一电脑多个ssh-key的管理

  3. 阿里云代码 SSH

最新文章

  1. SignalR实现网页实时聊天功能
  2. Http请求中请求头Content-Type 为 form-data、x-www-form-urlencoded、raw、binary的区别
  3. URL tailing slash
  4. RESTful API 设计指南【转】
  5. 笔记本_thinkpad_e40_FN
  6. VS2010 配置opencv环境
  7. 前端-mate讲解
  8. Git显示漂亮日志的小技巧
  9. [一波低姿势的usaco除草记]
  10. CentOS服务器上的 git 包版本控制
  11. ibv_open_device()函数
  12. Python/零起点(一、数字及元组)
  13. PCIE 2.0协议概念基本科普
  14. Spring框架+Struts2框架第一次整合
  15. Go程序语言设计 (艾伦 A. A. 多诺万 著)
  16. Git+Jenkins+FileGee 发布php应用
  17. stenciljs 学习七 路由
  18. UVa 12715 Watching the Kangaroo(二分)
  19. Django学习---原生ajax
  20. iOS 7 导航栏颜色设定与适配

热门文章

  1. 31_栈的分类.swf
  2. Spring mvc 面试
  3. 3、struct2的常见配置
  4. 02.Scrapy-Demo
  5. ATM项目分析
  6. RocketMQ入门到入土(一)新手也能看懂的原理和实战!
  7. openstack-taskflow 组件记录
  8. 一种基于LQR使输出更加稳定的算法(超级实用)
  9. Python HTTP Server (Simples)
  10. Canvas干货总结