AI写作智能体 自主规划任务,支持联网查询和网页读取,多模态高效创作各类分析报告、商业计划、营销方案、教学内容等。 广告
# 配置多git平台的ssh的方法 ***** 场景:个人的阿里云云效里面存的有自己的git仓库,现在需要配置一个公司的云效git的ssh密钥,实现git克隆、拉取、推送(等正常的开发流程) 1. 生成ssh密钥对(-C 里面,写的是注释,而不是账号,习惯写成了账号;cat 查看pub公钥;-f 后面跟的具体文件的保存路径) 生成的第一个ssh密钥对命令: ``` ssh-keygen -t rsa -C "wangyaqiang@1944796833270755.onaliyun.com" -f ~/.ssh/id_rsa_judian ``` 查看一个生成的公钥命令: ``` cat ~/.ssh/id_rsa_judian.pub ``` 生成的第二个ssh密钥对命令: ``` ssh-keygen -t rsa -C "1013762171@qq.com" -f ~/.ssh/id_rsa_self ``` 查看第二个生成的公钥命令: ``` cat ~/.ssh/id_rsa_self.pub ``` ![](https://img.kancloud.cn/26/e3/26e35430e4b63624f77e7d2a9b6517bf_1463x793.png) 2. 配置多ssh的方法(位置:~/.ssh,或者:C:\Users\Administrator\\.ssh)在此目录,創建config文件,内容如下: ``` # 剧点云效 Host codeup_judian_yunxiao HostName codeup.aliyun.com IdentityFile C:\Users\Administrator\.ssh\id_rsa_judian PreferredAuthentications publickey IdentityAgent none IdentitiesOnly yes # self云效 Host codeup_self_yunxiao HostName codeup.aliyun.com User 阳泽一生 IdentityFile C:\Users\Administrator\.ssh\id_rsa_self PreferredAuthentications publickey IdentityAgent none IdentitiesOnly yes ``` ![](https://img.kancloud.cn/e0/07/e007e1d452a63193d9790c837eaeb937_935x540.png) 3. 找到git管理平台的ssh密钥中,將pub公钥复制上去,在任意位置,执行(上面的是公司阿里云云效的ssh,下面的是个人阿里云云效的ssh),以下两个命令: Administrator@Tomorrow MINGW64 <span style="color:red">~/.ssh</span> $(当前位置)<span style="color:red">ssh -T -F ~/.ssh/config git@codeup_judian_yunxiao</span> <span style="color:blue">Welcome to Codeup, 王亚强!</span> Administrator@Tomorrow MINGW64(当前位置) <span style="color:red">~/.ssh</span> $(当前位置) <span style="color:red">ssh -T -F ~/.ssh/config git@codeup_self_yunxiao</span> <span style="color:blue">Welcome to Codeup, 阳泽一生!</span> ![](https://img.kancloud.cn/26/26/26266e14c4243eb98ab5263ab31328a7_1403x660.png) 4:上述出现结果,代表多账户(多平台)的ssh配置ok ![](https://img.kancloud.cn/04/16/04168a50707dd3e481298987dfc22668_1920x905.png) 5:可以执行git clone ssh地址(使用config配置的别名)了;原ssh地址: ``` git@codeup.aliyun.com:6409d268e9f200d37adc2ffd/WEB/vuePress.git ``` 别名的ssh地址: ``` git@codeup_self_yunxiao:6409d268e9f200d37adc2ffd/WEB/vuePress.git ``` 克隆仓库(使用git仓库别名地址进行克隆): ``` git clone git@codeup_self_yunxiao:6409d268e9f200d37adc2ffd/WEB/vuePress.git ``` ![](https://img.kancloud.cn/50/f5/50f56da5565efe97875f1f12479ab917_1449x349.png)