What are the supported git url formats?

Git accepts many different url formats (like ssh, http, https, etc.). Are there specs / white papers where I can find the supported git url formats?

I wrote a Git url parser and I want to make sure that what it's done there is correct.

Here on YonderGit I found the list below. It is not complete because it https://<token>:x-oauth-basic@host.xz/path/to/repo.git

does not exist.

Secure Shell Security 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 (file system) Transport protocol

  • /path/to/repo.git/

  • path/to/repo.git/

  • ~/path/to/repo.git

  • file:///path/to/repo.git/

  • file://~/path/to/repo.git/

+3


source to share


1 answer


You can see that git is ready to parse in urlmatch.h

and out urlmatch.c

.
This is used t0110-urlmatch-normalization.sh

, which illustrates the complete list of possible urls checked out with git.

url.c

mentions:



The set of valid URL schemes as per STD66 (RFC3986) is ' [A-Za-z][A-Za-z0-9+.-]*

'.
But use the more spectacular validation " [A-Za-z0-9][A-Za-z0-9+.-]*

" because the earlier version of validation used " [A-Za-z0-9]+

" to not break the remote assistants.

+2


source







All Articles