流沙团
git clone 指定用户名和密码
2022-11-18 流沙团
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
【注】转义仅仅是在命令行或者是代码中需要,如果使用的是工具的话可以不用转义,工具会帮我们进行转义。
发表评论:
昵称

邮件地址 (选填)

个人主页 (选填)

内容