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