Git 接受许多不同的 url 格式(例如 ssh、http、https 等)。是否有任何规范/官方文档可以在其中找到受支持的 git url 格式?
我写了一个git url 解析器 https://github.com/IonicaBizau/node-git-url-parse我想确保那里所做的事情是正确的。
在这里,在 YonderGit 上 http://jeetworks.org/yondergit-simplified-git-remote-repository-management/,我找到了下面的列表。它并不完整,因为https://<token>:[email protected] /cdn-cgi/l/email-protection/path/to/repo.git
不在这里。
安全外壳传输协议
ssh://[email protected] /cdn-cgi/l/email-protection:port/path/to/repo.git/
ssh://[email protected] /cdn-cgi/l/email-protection/path/to/repo.git/
ssh://host.xz:port/path/to/repo.git/
ssh://host.xz/path/to/repo.git/
ssh://[email protected] /cdn-cgi/l/email-protection/path/to/repo.git/
ssh://host.xz/path/to/repo.git/
ssh://[email protected] /cdn-cgi/l/email-protection/~user/path/to/repo.git/
ssh://host.xz/~user/path/to/repo.git/
ssh://[email protected] /cdn-cgi/l/email-protection/~/path/to/repo.git
ssh://host.xz/~/path/to/repo.git
[email protected] /cdn-cgi/l/email-protection:/path/to/repo.git/
host.xz:/path/to/repo.git/
[email protected] /cdn-cgi/l/email-protection:~user/path/to/repo.git/
host.xz:~user/path/to/repo.git/
[email protected] /cdn-cgi/l/email-protection:path/to/repo.git
host.xz:path/to/repo.git
rsync://host.xz/path/to/repo.git/
Git 传输协议
git://host.xz/path/to/repo.git/
git://host.xz/~user/path/to/repo.git/
HTTP/S 传输协议
http://host.xz/path/to/repo.git/
https://host.xz/path/to/repo.git/
本地(文件系统)传输协议
/path/to/repo.git/
path/to/repo.git/
~/path/to/repo.git
file:///path/to/repo.git/
file://~/path/to/repo.git/
你可以看到git准备解析什么内容urlmatch.h https://github.com/git/git/blob/77bd3ea9f54f1584147b594abc04c26ca516d987/urlmatch.h and urlmatch.c https://github.com/git/git/blob/77bd3ea9f54f1584147b594abc04c26ca516d987/urlmatch.c.
这是由t0110-urlmatch-normalization.sh https://github.com/git/git/blob/77bd3ea9f54f1584147b594abc04c26ca516d987/t/t0110-urlmatch-normalization.sh,它说明了 git 测试的可能 url 的完整列表。
url.c https://github.com/git/git/blob/77bd3ea9f54f1584147b594abc04c26ca516d987/url.c确实提到:
根据 STD66 (RFC3986),有效的 URL 方案集是 '[A-Za-z][A-Za-z0-9+.-]*
'.
但使用稍微宽松的检查 '[A-Za-z0-9][A-Za-z0-9+.-]*
'因为使用了早期版本的检查'[A-Za-z0-9]+
' 这样就不会破坏任何远程助手。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)