支持哪些 git url 格式?
What are the supported git url formats?
Git 接受许多不同的 url 格式(例如 ssh、http、https 等)。有没有 specifications/official 文档可以找到支持的 git url 格式?
我写了一个git url parser,我想确定它在那里所做的是正确的。
Here, on YonderGit,我找到了下面的列表。它不完整,因为 https://<token>:x-oauth-basic@host.xz/path/to/repo.git
不存在。
Secure Shell Transport Protocol
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.git
ssh://host.xz/~/path/to/repo.git
user@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.git
host.xz:path/to/repo.git
rsync://host.xz/path/to/repo.git/
Git Transport Protocol
git://host.xz/path/to/repo.git/
git://host.xz/~user/path/to/repo.git/
HTTP/S Transport Protocol
http://host.xz/path/to/repo.git/
https://host.xz/path/to/repo.git/
Local (Filesystem) Transport Protocol
/path/to/repo.git/
path/to/repo.git/
~/path/to/repo.git
file:///path/to/repo.git/
file://~/path/to/repo.git/
你可以在urlmatch.h
and urlmatch.c
中看到git准备解析的内容。
t0110-urlmatch-normalization.sh
使用了它,它说明了 git 测试的可能 url 的完整列表。
url.c
确实提到:
The set of valid URL schemes, as per STD66 (RFC3986) is '[A-Za-z][A-Za-z0-9+.-]*
'.
But use sightly looser check of '[A-Za-z0-9][A-Za-z0-9+.-]*
' because earlier version of check used '[A-Za-z0-9]+
' so not to break any remote helpers.
Git 接受许多不同的 url 格式(例如 ssh、http、https 等)。有没有 specifications/official 文档可以找到支持的 git url 格式?
我写了一个git url parser,我想确定它在那里所做的是正确的。
Here, on YonderGit,我找到了下面的列表。它不完整,因为 https://<token>:x-oauth-basic@host.xz/path/to/repo.git
不存在。
Secure Shell Transport Protocol
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.git
ssh://host.xz/~/path/to/repo.git
user@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.git
host.xz:path/to/repo.git
rsync://host.xz/path/to/repo.git/
Git Transport Protocol
git://host.xz/path/to/repo.git/
git://host.xz/~user/path/to/repo.git/
HTTP/S Transport Protocol
http://host.xz/path/to/repo.git/
https://host.xz/path/to/repo.git/
Local (Filesystem) Transport Protocol
/path/to/repo.git/
path/to/repo.git/
~/path/to/repo.git
file:///path/to/repo.git/
file://~/path/to/repo.git/
你可以在urlmatch.h
and urlmatch.c
中看到git准备解析的内容。
t0110-urlmatch-normalization.sh
使用了它,它说明了 git 测试的可能 url 的完整列表。
url.c
确实提到:
The set of valid URL schemes, as per STD66 (RFC3986) is '
[A-Za-z][A-Za-z0-9+.-]*
'.
But use sightly looser check of '[A-Za-z0-9][A-Za-z0-9+.-]*
' because earlier version of check used '[A-Za-z0-9]+
' so not to break any remote helpers.