Mac 环境下连接多个git — ssh方式
生活随笔
收集整理的這篇文章主要介紹了
Mac 环境下连接多个git — ssh方式
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Mac 環境下連接多個git — ssh方式
1.查看當前是否存在ssh
ls ~/.ssh/ 看到 id_rsa 與 id_rsa_pub 則說明已經有一對密鑰。2.生產新的公鑰,并命名它不于之前的沖突
ssh-keygen -t rsa -f ~/.ssh/id_rsa_2 -C "yourmail@xxx.com"3.配置sshKey對應的Host
vim ~/.ssh/config 根據實際的Host修改文件,例如有github和ieit兩個Host,則像如下方式修改 # default Host github.com HostName github.com User git IdentityFile ~/.ssh/id_rsa # two Host ieit.github.com HostName github.com User git IdentityFile ~/.ssh/id_rsa_24.復制新生成的ssh-key,去相應的地方配置
pbcopy < ~/.ssh/id_rsa.pub5.測試是否成功
ssh -T git@yourhost.com 收到入下信息表示配置成功 The authenticity of host 'github.com (192.30.255.112)' can't be established. RSA key fingerprint is SHA256:sdfsxxxxxxxxxxxxxxxxxxx. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'github.com,192.30.255.112' (RSA) to the list of known hosts. Hi gsbybb! You've successfully authenticated, but GitHub does not provide shell access.6.克隆repo
7.取消全局 用戶名/郵箱設置,并進入項目文件夾單獨設置
8.命令行進入項目目錄,重建 origin
git remote rm origin git remote add origin git@ieit.github.com9.成功,可以 push 測試一下
總結
以上是生活随笔為你收集整理的Mac 环境下连接多个git — ssh方式的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ORACLE授权用户查询另一个用户下的表
- 下一篇: nodejs下载安装教程(XP版)