Git接受许多不同的url格式(例如ssh、http、https等)。是否有任何规范/官方文档可以找到受支持的git url格式?
我写了一个git url解析器,我想确定它在那里所做的是正确的。
这里,在YonderGit上,我找到了下面的列表。由于https://<token>:x-oauth-basic@host.xz/path/to/repo.git不存在,所以它还没有完成。
安全壳传输协议
ssh://user@host.xz:port/path/to/repo.git/ssh://user@host.xz/path/to/repo.git/ssh://host.xz:port/path/to/repo.git/ssh://host.xz/path/to/repo.git/ssh://user@host.xz/path/to/repo.git/ssh://host.xz/path/to/repo.git/ssh://user@host.xz/~user/path/to/repo.git/ssh://host.xz/~user/path/to/repo.git/ssh://user@host.xz/~/path/to/repo.gitssh://host.xz/~/path/to/repo.gituser@host.xz:/path/to/repo.git/host.xz:/path/to/repo.git/user@host.xz:~user/path/to/repo.git/host.xz:~user/path/to/repo.git/user@host.xz:path/to/repo.githost.xz:path/to/repo.gitrsync://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.gitfile:///path/to/repo.git/file://~/path/to/repo.git/发布于 2015-08-04 05:46:20
您可以看到git准备在urlmatch.h和urlmatch.c中解析什么。
这是t0110-urlmatch-normalization.sh使用的,它说明了git测试的可能的url的完整列表。
url.c的确提到:
根据STD66 (RFC3986),一组有效的URL方案是“
[A-Za-z][A-Za-z0-9+.-]*”。 但是要使用更宽松的“[A-Za-z0-9][A-Za-z0-9+.-]*”检查,因为早期版本的check使用了“[A-Za-z0-9]+”,这样就不会破坏任何远程帮助程序。
https://stackoverflow.com/questions/31801271
复制相似问题