受支持的git url格式是什么? [英] What are the supported git url formats?
问题描述
Git接受许多不同的url格式(例如ssh,http,https等).是否有任何规范/官方文档可以找到受支持的git url格式?
Git accepts a lot of different url formats (e.g. ssh, http, https etc). Are there any specifications/official docs where I can find the supported git url formats?
我写了一个 git url解析器,我想确定在那里做对了.
I wrote a git url parser and I want to be sure that what it's done there is correct.
在YonderGit上,我找到了以下列表.由于https://<token>:x-oauth-basic@host.xz/path/to/repo.git
不存在,因此不完整.
Here, on YonderGit, I found the list below. It is not complete since https://<token>:x-oauth-basic@host.xz/path/to/repo.git
is not there.
安全外壳传输协议
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/
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://host.xz/path/to/repo.git/
-
git://host.xz/~user/path/to/repo.git/
git://host.xz/path/to/repo.git/
git://host.xz/~user/path/to/repo.git/
-
http://host.xz/path/to/repo.git/
-
https://host.xz/path/to/repo.git/
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/
/path/to/repo.git/
path/to/repo.git/
~/path/to/repo.git
file:///path/to/repo.git/
file://~/path/to/repo.git/
推荐答案
您可以在 urlmatch.c
.
由 t0110-urlmatch-normalization.sh
使用展示了git测试的所有可能的url的完整列表.
You can see what git is prepared to parse in urlmatch.h
and urlmatch.c
.
That is used by t0110-urlmatch-normalization.sh
, which illustrates the full list of possible url tested by git.
url.c
确实提到:
url.c
does mention:
根据STD66(RFC3986),有效URL方案的集合为'
[A-Za-z][A-Za-z0-9+.-]*
'.
但是请使用对'[A-Za-z0-9][A-Za-z0-9+.-]*
'较为宽松的检查,因为较早版本的检查使用了'[A-Za-z0-9]+
',因此不会破坏任何远程帮助程序.
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格式是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!