ubuntu 同時遠程github和gitee

一. githtml

    1.1.關於git使用參考:https://www.cnblogs.com/linux-37ge/p/11073451.htmllinux

    1.2. 以前寫的關於上傳代碼到github:http://www.javashuo.com/article/p-phnmjytc-bn.htmlgit

二. remote github和giteegithub

    2.1. 原理和上述1.2裏連接同樣shell

         2.1.1. 生產兩個平臺的keyssh

ssh-keygen -t rsa -C "xxxxxxx@qq.com" -f "github_id_rsa"
ssh-keygen -t rsa -C "xxxxxxx@qq.com" -f "gitee_id_rsa"

    2.1.2. 設置完成後生產以下文件:ide

     2.2. 上傳key.net

            2.2.1. 執行命令cat github_id_rsa.pub把第二行到結尾的內容複製到github的ssh中保存htm

            2.2.2. 一樣的操做,添加gitee的sshblog

    2.3. 建立config文件解決ssh衝突

        2.3.1. 在.ssh文件夾下執行命令vi config,並添加以下內容

# gitee
Host gitee.com
HostName gitee.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/gitee_id_rsa
 
# github
Host github.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/github_id_rsa

三. 驗證

    執行ssh -T git@gitee.com
    成功則返回
          Welcome to Gitee.com ,yourname!
    執行ssh -T git@github.com
    成功則返回
         Hi xxx! You've successfully authenticated, but GitHub does not provide shell access.

 

 

參考文獻:https://blog.csdn.net/londa/article/details/92065424

相關文章
相關標籤/搜索