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

【注】转义仅仅是在命令行或者是代码中需要,如果使用的是工具的话可以不用转义,工具会帮我们进行转义。

posted on 2021-07-05 07:50  刘应杰  阅读(3124)  评论(0编辑  收藏  举报

导航