git命令中带有特殊符号如@

时间:2022-10-24 14:07:02

使用带用户密码clone的方式:
git clone https://username:password@remote

当username和password中含有特殊符号会导致出错,
因为为http的请求,所以需要将特殊符号encode成url格式的

java使用:

String c = java.net.URLEncoder.encode(".","utf-8");
System.out.println(c);

源文档 <http://blog.csdn.net/qq1142003960/article/details/48323495>