git连接远程仓库的配置中带特殊字符的处理方式

配置文件地址.git/config

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "origin"]
        url = "https://username:123@[email protected]/router/conf.git"
        fetch = +refs/heads/*:refs/remotes/origin/*

如果这样的话,那么在请求url的时候会将第一个@后面的字符串当成git服务器的地址,所以这个时候就会报错

Couldn't resolve '[email protected]'

所以需要针对特殊字符进行修改,换成可识别的字符,@就是%40,改成下面的配置即可

url = "https://username:123%[email protected]/router/conf.git"

其它url特殊字符参考下表

空格	-	%20
"		-	%22
#		-   %23
%		-   %25
&		-   %26
(		-   %28
)       -   %29
+       -   %2B
,		-   %2C
/		-   %2F
:		-   %3A
;		-   %3B
<		-   %3C
=		-   %3D
>		-   %3E
?		-   %3F
@		-   %40
\       -   %5C
|       -   %7C

你可能感兴趣的:(故障排查,git,运维,linux)