1GIT-LS-REMOTE(1) Git Manual GIT-LS-REMOTE(1)
2
3
4
6 git-ls-remote - List references in a remote repository
7
9 git ls-remote [--heads] [--tags] [--refs] [--upload-pack=<exec>]
10 [-q | --quiet] [--exit-code] [--get-url] [--sort=<key>]
11 [--symref] [<repository> [<patterns>...]]
12
14 Displays references available in a remote repository along with the
15 associated commit IDs.
16
18 -h, --heads, -t, --tags
19 Limit to only refs/heads and refs/tags, respectively. These options
20 are not mutually exclusive; when given both, references stored in
21 refs/heads and refs/tags are displayed. Note that git ls-remote -h
22 used without anything else on the command line gives help,
23 consistent with other git subcommands.
24
25 --refs
26 Do not show peeled tags or pseudorefs like HEAD in the output.
27
28 -q, --quiet
29 Do not print remote URL to stderr.
30
31 --upload-pack=<exec>
32 Specify the full path of git-upload-pack on the remote host. This
33 allows listing references from repositories accessed via SSH and
34 where the SSH daemon does not use the PATH configured by the user.
35
36 --exit-code
37 Exit with status "2" when no matching refs are found in the remote
38 repository. Usually the command exits with status "0" to indicate
39 it successfully talked with the remote repository, whether it found
40 any matching refs.
41
42 --get-url
43 Expand the URL of the given remote repository taking into account
44 any "url.<base>.insteadOf" config setting (See git-config(1)) and
45 exit without talking to the remote.
46
47 --symref
48 In addition to the object pointed by it, show the underlying ref
49 pointed by it when showing a symbolic ref. Currently, upload-pack
50 only shows the symref HEAD, so it will be the only one shown by
51 ls-remote.
52
53 --sort=<key>
54 Sort based on the key given. Prefix - to sort in descending order
55 of the value. Supports "version:refname" or "v:refname" (tag names
56 are treated as versions). The "version:refname" sort order can also
57 be affected by the "versionsort.suffix" configuration variable. See
58 git-for-each-ref(1) for more sort options, but be aware keys like
59 committerdate that require access to the objects themselves will
60 not work for refs whose objects have not yet been fetched from the
61 remote, and will give a missing object error.
62
63 -o <option>, --server-option=<option>
64 Transmit the given string to the server when communicating using
65 protocol version 2. The given string must not contain a NUL or LF
66 character. When multiple --server-option=<option> are given, they
67 are all sent to the other side in the order listed on the command
68 line.
69
70 <repository>
71 The "remote" repository to query. This parameter can be either a
72 URL or the name of a remote (see the GIT URLS and REMOTES sections
73 of git-fetch(1)).
74
75 <patterns>...
76 When unspecified, all references, after filtering done with --heads
77 and --tags, are shown. When <patterns>... are specified, only
78 references matching one or more of the given patterns are
79 displayed. Each pattern is interpreted as a glob (see glob in
80 gitglossary(7)) which is matched against the "tail" of a ref,
81 starting either from the start of the ref (so a full name like
82 refs/heads/foo matches) or from a slash separator (so bar matches
83 refs/heads/bar but not refs/heads/foobar).
84
86 The output is in the format:
87
88 <oid> TAB <ref> LF
89
90 When showing an annotated tag, unless --refs is given, two such lines
91 are shown: one with the refname for the tag itself as <ref>, and
92 another with <ref> followed by ^{}. The <oid> on the latter line shows
93 the name of the object the tag points at.
94
96 • List all references (including symbolics and pseudorefs), peeling
97 tags:
98
99 $ git ls-remote
100 27d43aaaf50ef0ae014b88bba294f93658016a2e HEAD
101 950264636c68591989456e3ba0a5442f93152c1a refs/heads/main
102 d9ab777d41f92a8c1684c91cfb02053d7dd1046b refs/heads/next
103 d4ca2e3147b409459955613c152220f4db848ee1 refs/tags/v2.40.0
104 73876f4861cd3d187a4682290ab75c9dccadbc56 refs/tags/v2.40.0^{}
105
106 • List all references matching given patterns:
107
108 $ git ls-remote http://www.kernel.org/pub/scm/git/git.git master seen rc
109 5fe978a5381f1fbad26a80e682ddd2a401966740 refs/heads/master
110 c781a84b5204fb294c9ccc79f8b3baceeb32c061 refs/heads/seen
111
112 • List only tags matching a given wildcard pattern:
113
114 $ git ls-remote --tags http://www.kernel.org/pub/scm/git/git.git v\*
115 485a869c64a68cc5795dd99689797c5900f4716d refs/tags/v2.39.2
116 cbf04937d5b9fcf0a76c28f69e6294e9e3ecd7e6 refs/tags/v2.39.2^{}
117 d4ca2e3147b409459955613c152220f4db848ee1 refs/tags/v2.40.0
118 73876f4861cd3d187a4682290ab75c9dccadbc56 refs/tags/v2.40.0^{}
119
121 git-check-ref-format(1).
122
124 Part of the git(1) suite
125
126
127
128Git 2.43.0 11/20/2023 GIT-LS-REMOTE(1)