1GIT URLS[[URLS]] 2---------------- 3 4In general, URLs contain information about the transport protocol, the 5address of the remote server, and the path to the repository. 6Depending on the transport protocol, some of this information may be 7absent. 8 9Git supports ssh, git, http, and https protocols (in addition, ftp, 10and ftps can be used for fetching and rsync can be used for fetching 11and pushing, but these are inefficient and deprecated; do not use 12them). 13 14The native transport (i.e. git:// URL) does no authentication and 15should be used with caution on unsecured networks. 16 17The following syntaxes may be used with them: 18 19- ssh://{startsb}user@{endsb}host.xz{startsb}:port{endsb}/path/to/repo.git/ 20- git://host.xz{startsb}:port{endsb}/path/to/repo.git/ 21- http{startsb}s{endsb}://host.xz{startsb}:port{endsb}/path/to/repo.git/ 22- ftp{startsb}s{endsb}://host.xz{startsb}:port{endsb}/path/to/repo.git/ 23- rsync://host.xz/path/to/repo.git/ 24 25An alternative scp-like syntax may also be used with the ssh protocol: 26 27- {startsb}user@{endsb}host.xz:path/to/repo.git/ 28 29The ssh and git protocols additionally support ~username expansion: 30 31- ssh://{startsb}user@{endsb}host.xz{startsb}:port{endsb}/~{startsb}user{endsb}/path/to/repo.git/ 32- git://host.xz{startsb}:port{endsb}/~{startsb}user{endsb}/path/to/repo.git/ 33- {startsb}user@{endsb}host.xz:/~{startsb}user{endsb}/path/to/repo.git/ 34 35For local repositories, also supported by Git natively, the following 36syntaxes may be used: 37 38- /path/to/repo.git/ 39- \file:///path/to/repo.git/ 40 41ifndef::git-clone[] 42These two syntaxes are mostly equivalent, except when cloning, when 43the former implies --local option. See linkgit:git-clone[1] for 44details. 45endif::git-clone[] 46 47ifdef::git-clone[] 48These two syntaxes are mostly equivalent, except the former implies 49--local option. 50endif::git-clone[] 51 52When Git doesn't know how to handle a certain transport protocol, it 53attempts to use the 'remote-<transport>' remote helper, if one 54exists. To explicitly request a remote helper, the following syntax 55may be used: 56 57- <transport>::<address> 58 59where <address> may be a path, a server and path, or an arbitrary 60URL-like string recognized by the specific remote helper being 61invoked. See linkgit:gitremote-helpers[1] for details. 62 63If there are a large number of similarly-named remote repositories and 64you want to use a different format for them (such that the URLs you 65use will be rewritten into URLs that work), you can create a 66configuration section of the form: 67 68------------ 69 [url "<actual url base>"] 70 insteadOf = <other url base> 71------------ 72 73For example, with this: 74 75------------ 76 [url "git://git.host.xz/"] 77 insteadOf = host.xz:/path/to/ 78 insteadOf = work: 79------------ 80 81a URL like "work:repo.git" or like "host.xz:/path/to/repo.git" will be 82rewritten in any context that takes a URL to be "git://git.host.xz/repo.git". 83 84If you want to rewrite URLs for push only, you can create a 85configuration section of the form: 86 87------------ 88 [url "<actual url base>"] 89 pushInsteadOf = <other url base> 90------------ 91 92For example, with this: 93 94------------ 95 [url "ssh://example.org/"] 96 pushInsteadOf = git://example.org/ 97------------ 98 99a URL like "git://example.org/path/to/repo.git" will be rewritten to 100"ssh://example.org/path/to/repo.git" for pushes, but pulls will still 101use the original URL.