Windows GIT SSH 免密教程


Windows GIT SSH 免密教程

  1. 安裝git客戶端,最新下載地址如下 https://github.com/git-for-windows/git/releases/download/v2.23.0.windows.1/Git-2.23.0-64-bit.exe

  2. 安裝完畢后, 進入.ssh目錄,筆者目錄如下:
    C:\Users\Administrator.ssh,進入后,右鍵

    git bash here
    
  3. 新建ssh key

    ssh-keygen -t rsa -==C== "chonguo@126.com"
    鍵入 id_rsa_gitee
    按enter鍵直到結束,這時會發現生成兩個私鑰和公鑰
    
  4. 將私鑰加入到ssh agent

    ssh-add ~/.ssh/id_rsa_gitee
    

    如果出現 Could not open a connection to your authentication agent.
    則需要

    ssh-agent bash
    ssh-add ~/.ssh/id_rsa_gitee
    
  5. 在該目錄下新建config文件

   
	 #該配置用於個人gitee 上  
    #Host 服務器別名  
    Host gitee.com
    #HostName 服務器ip地址或機器名  
    HostName gitee.com
    #User連接服務器的用戶名  
    User chonguo@126.com
    #IdentityFile 密匙文件的具體路徑  
    IdentityFile C:\Users\Administrator\.ssh\id_rsa_oschina
    
    #該配置用於個人 github 上  
    #Host 服務器別名  
    Host github.com
    #HostName 服務器ip地址或機器名  
    HostName github.com
    #User連接服務器的用戶名  
    User chonguo@126.com
    #IdentityFile 密匙文件的具體路徑  
    IdentityFile C:\Users\Administrator\.ssh\id_rsa_github

    #該配置用於aliyun code 上  
    #Host 服務器別名  
    Host code.aliyun.com
    RSAAuthentication yes
    #HostName 服務器ip地址或機器名  
    HostName code.aliyun.com
    #User連接服務器的用戶名  
    User chonguo@163.com
    #IdentityFile 密匙文件的具體路徑  
    IdentityFile C:\Users\Administrator\.ssh\id_rsa_aliyun
  1. 登錄gitee或者github配置ssh keys,用notepad打開並復制id_rsa_gitee.pub中內容即可


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM