用法:
-
git clone https://username:password@remote-git-repository-url
-
# 例如
-
git clone https://roc:123456@e.coding.net/roc/example.git
如果用戶名使用的是郵箱,那么 @ 符號需要轉義成 %40
,否則會無法識別郵箱,與 Git 倉庫地址前面的 @ 造成沖突:
-
# 例如
-
git clone https://roc@qq.com:123456@e.coding.net/roc/example.git
-
# 需要寫成
-
git clone https://roc%40qq.com:123456@e.coding.net/roc/example.git
【注】轉義僅僅是在命令行或者是代碼中需要,如果使用的是工具的話可以不用轉義,工具會幫我們進行轉義。