git带有特殊字符的密码

参考文档: https://blog.csdn.net/daihaoxin/article/details/119573422

如果使用用户名+密码的方式来 clone 远程仓库,如下形式:

git clone https://<user>:<password>@<gitserver>/<path>/<repo>.git

如果密码是纯文本,则可以正常工作,但如果密码具有感叹号等特殊字符,则需要使用 URL 编码。

! # $ & ( ) * +
%21 %23 %24 %26 %27 %28 %29 %2A %2B
* + , / : ; = ? @ [ ]
%2A %2B %2C %2F %3A %3B %3D %3F %40 %5B %5D

使用凭据 myuser/password!github 存储库将如下所示:

git clone https://myuser:password%21@github.com/myuser/repo.git