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> [<refs>...]]
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 <refs>...
76 When unspecified, all references, after filtering done with --heads
77 and --tags, are shown. When <refs>... are specified, only
78 references matching the given patterns are displayed.
79
81 $ git ls-remote --tags ./.
82 d6602ec5194c87b0fc87103ca4d67251c76f233a refs/tags/v0.99
83 f25a265a342aed6041ab0cc484224d9ca54b6f41 refs/tags/v0.99.1
84 7ceca275d047c90c0c7d5afb13ab97efdf51bd6e refs/tags/v0.99.3
85 c5db5456ae3b0873fc659c19fafdde22313cc441 refs/tags/v0.99.2
86 0918385dbd9656cab0d1d81ba7453d49bbc16250 refs/tags/junio-gpg-pub
87 $ git ls-remote http://www.kernel.org/pub/scm/git/git.git master seen rc
88 5fe978a5381f1fbad26a80e682ddd2a401966740 refs/heads/master
89 c781a84b5204fb294c9ccc79f8b3baceeb32c061 refs/heads/seen
90 $ git remote add korg http://www.kernel.org/pub/scm/git/git.git
91 $ git ls-remote --tags korg v\*
92 d6602ec5194c87b0fc87103ca4d67251c76f233a refs/tags/v0.99
93 f25a265a342aed6041ab0cc484224d9ca54b6f41 refs/tags/v0.99.1
94 c5db5456ae3b0873fc659c19fafdde22313cc441 refs/tags/v0.99.2
95 7ceca275d047c90c0c7d5afb13ab97efdf51bd6e refs/tags/v0.99.3
96
98 git-check-ref-format(1).
99
101 Part of the git(1) suite
102
103
104
105Git 2.39.1 2023-01-13 GIT-LS-REMOTE(1)