git clone with username and password

git clone 是用来从已有的 Git 仓库克隆出一个新的镜像仓库到本地的。
有些时候需要带着用户名和密码进行clone

命令是

git clone http://username:password@host:/path/to/repository

//比如:
git clone http://xiaoming:1234@github.com/schacon/example.git

其中:

  1. "http://“是协议;
  2. username和password中,「@」、「!」等要进行url encoding
!    #    $     &    '    (    )    *    +    ,    /    :    ;    =    ?    @    [    ]
%21  %23  %24   %26  %27  %28  %29  %2A  %2B  %2C  %2F  %3A  %3B  %3D  %3F  %40  %5B  %5D
  1. "host:/path/to/repository”,去掉http(s):// 或者git@

ok,就酱。

>>> hex(ord('!')) ‘0x21’后两位数值和上面的表格数字一样。
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容