通过 WebDAV git http push - 如果我的用户名有一个“@”怎么办?在里面?
我的网络托管提供商允许我通过 WebDAV 访问我的网络空间,所以我想我应该在那里设置一个 git 存储库,看看会发生什么。以只读方式克隆存储库效果很好,如“git clone http://my.server.com/ repo.git”仅使用标准 HTTP 传输。
当我尝试使用 WebDAV 时出现问题,因为我的用户 ID 是“[email protected]< /a>”,我必须使用端口 2077。这意味着我必须做类似的事情
git config remote.origin.pushurl http://[email protected]@my.server.com:2077/repo.git
,并且 URL 中的两个 @ 符号一定会导致问题,因为“git Push origin master”报告“错误 22”。
我尝试创建一个 .netrc 文件条目
machine my.server.com
login [email protected]
password ****
,但这似乎没有帮助。
我也尝试过用“%”、“\@”和“%40”替换第一个“@”,但这些都不起作用。
My web hosting provider lets me access my webspace via WebDAV, so I thought I'd set up a git repository over there just to see what happens. Cloning the repository read-only works just fine, as "git clone http://my.server.com/repo.git" just uses the standard HTTP transport.
Problems arise when I try to use WebDAV, because my user id is "[email protected]" and I have to use port 2077. This means I have to do something like
git config remote.origin.pushurl http://[email protected]@my.server.com:2077/repo.git
and the two @ signs in the URL must be causing problems because "git push origin master" reports "error 22".
I tried creating a .netrc file entry
machine my.server.com
login [email protected]
password ****
but that didn't seem to help.
I've also tried replacing the first "@" with a "%", "\@" and "%40" but none of those worked.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当前版本的 git 不处理用户名和密码中的百分比转义。我昨天提交了一个补丁来修复这个问题(至少对于 HTTP URL),所以它可能很快就会被修复。使用补丁后,您应该能够通过以下方式访问 WebDAV:
git config remote.origin.pushurl http://user%[电子邮件受保护]:2077/repo.git
但是您可能有另一个与 libcurl > 问题相关的问题7.16(请参阅“git help http-push”中的注释)在我撰写本文时。
The current version of git doesn't handle percent-unescaping in username and password. I submitted a patch yesterday to fix this (at least for HTTP URLs) so it might be fixed soon. With the patch, you should be able to access the WebDAV with:
git config remote.origin.pushurl http://user%[email protected]:2077/repo.git
However you may have another problem related to an issue with libcurl > 7.16 (see the note in "git help http-push") at the time I'm writing.
如果 WebDAV 使用的 URI 确实遵循统一资源标识符 (URI):通用语法 (rfc3986) 中不应有任何
@
userinfo
那么你是否尝试过
http://[电子邮件受保护]:2077/repo.git
?If the URI used by WebDAV does follow the Uniform Resource Identifier (URI): Generic Syntax (rfc3986), there should not be any
@
in theuserinfo
So did you try just with
http://[email protected]:2077/repo.git
?