git clone 指定用戶名和密碼


用法:

  1.  
    git clone https://username:password@remote-git-repository-url
  2.  
    # 例如
  3.  
    git clone https://roc:123456@e.coding.net/roc/example.git

如果用戶名使用的是郵箱,那么 @ 符號需要轉義成 %40,否則會無法識別郵箱,與 Git 倉庫地址前面的 @ 造成沖突:

  1.  
    # 例如
  2.  
    git clone https://roc@qq.com:123456@e.coding.net/roc/example.git
  3.  
    # 需要寫成
  4.  
    git clone https://roc%40qq.com:123456@e.coding.net/roc/example.git

【注】轉義僅僅是在命令行或者是代碼中需要,如果使用的是工具的話可以不用轉義,工具會幫我們進行轉義。


免責聲明!

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



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