blob: 948baa7322846b48670765959516a08db3e8f5f8 [file] [log] [blame]
Shawn O. Pearce4016a932009-05-28 15:12:40 -07001gerrit ls-projects
2==================
3
4NAME
5----
6gerrit ls-projects - List projects visible to caller
7
8SYNOPSIS
9--------
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -080010--
Shawn O. Pearce47769242011-06-14 16:40:48 -070011'ssh' -p <port> <host> 'gerrit ls-projects'
12 [--show-branch <BRANCH> ...]
Edwin Kempin73b26982012-07-16 13:53:22 +020013 [--description | -d]
14 [--tree | -t]
Shawn O. Pearce47769242011-06-14 16:40:48 -070015 [--type {code | permissions | all}]
Edwin Kempin73b26982012-07-16 13:53:22 +020016 [--format {text | json | json_compact}]
17 [--all]
18 [--limit <N>]
Edwin Kempinf0c70422012-08-24 15:34:20 +020019 [--has-acl-for GROUP]
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -080020--
Shawn O. Pearce4016a932009-05-28 15:12:40 -070021
22DESCRIPTION
23-----------
24Displays the list of project names, one per line, that the
25calling user account has been granted 'READ' access to.
26
27If the caller is a member of the privileged 'Administrators'
28group, all projects are listed.
29
30ACCESS
31------
Shawn O. Pearcea0418982012-04-05 09:10:02 -070032Any user who has configured an SSH key, or by an user over HTTP.
Shawn O. Pearce4016a932009-05-28 15:12:40 -070033
34SCRIPTING
35---------
36This command is intended to be used in scripts.
37
Nico Sallembien0d6312d2010-03-15 14:48:44 -070038OPTIONS
39-------
Shawn O. Pearce47769242011-06-14 16:40:48 -070040--show-branch::
41-b::
Anatol Pomazau37395692011-05-24 06:50:38 -070042Branch for which the command will display the sha of each project.
Shawn O. Pearce47769242011-06-14 16:40:48 -070043The command may have multiple --show-branch parameters, in this case
Anatol Pomazau37395692011-05-24 06:50:38 -070044sha will be shown for each of the branches.
45If the user does not have READ access to some branch or the branch does not
Shawn O. Pearce47769242011-06-14 16:40:48 -070046exist then stub (40 `-` symbols) is shown.
Anatol Pomazau37395692011-05-24 06:50:38 -070047If the user does not have access to any branch in the project then the
48whole project is not shown.
Nico Sallembien0d6312d2010-03-15 14:48:44 -070049
Gustaf Lundh87cea022011-09-01 15:56:59 +020050--description::
Edwin Kempin73b26982012-07-16 13:53:22 +020051-d::
Gustaf Lundh87cea022011-09-01 15:56:59 +020052Allows listing of projects together with their respective
53description.
Edwin Kempin9ad27612011-11-21 10:59:25 +010054+
Magnus Bäck21f533a2012-03-22 09:55:03 -040055For text format output, all non-printable characters (ASCII value 31 or
56less) are escaped according to the conventions used in languages like C,
57Python, and Perl, employing standard sequences like `\n` and `\t`, and
58`\xNN` for all others. In shell scripts, the `printf` command can be
59used to unescape the output.
Gustaf Lundh87cea022011-09-01 15:56:59 +020060
Shawn O. Pearce47769242011-06-14 16:40:48 -070061--tree::
62-t::
lincoln5bfabe52010-05-31 16:23:53 -030063Displays project inheritance in a tree-like format.
64This option does not work together with the show-branch option.
65
Shawn O. Pearce7fdf53e2011-06-14 14:52:59 -070066--type::
Shawn O. Pearce47769242011-06-14 16:40:48 -070067Display only projects of the specified type. If not
68specified, defaults to `code`. Supported types:
Shawn O. Pearce7b825b32012-04-05 09:10:41 -070069+
70--
71`code`:: Any project likely to contain user files.
72`permissions`:: Projects created with the `--permissions-only` flag.
73`all`:: Any type of project.
74--
Edwin Kempinf179be22011-09-22 14:34:02 +020075
Shawn O. Pearceec9efd72012-04-04 20:44:39 -070076--format::
77What output format to display the results in.
78+
79--
80`text`:: Simple text based format.
81`json`:: Map of JSON objects describing each project.
82`json_compact`:: Minimized JSON output.
83--
84
Edwin Kempinf179be22011-09-22 14:34:02 +020085--all::
86Display all projects that are accessible by the calling user
87account. Besides the projects that the calling user account has
88been granted 'READ' access to, this includes all projects that
89are owned by the calling user account (even if for these projects
90the 'READ' access right is not assigned to the calling user
91account).
Shawn O. Pearce7fdf53e2011-06-14 14:52:59 -070092
Shawn O. Pearce5cd05772012-04-07 13:47:18 -070093--limit::
94Cap the number of results to the first N matches.
95
Edwin Kempinf0c70422012-08-24 15:34:20 +020096--has-acl-for::
97Display only projects on which access rights for this group are
98directly assigned. Projects which only inherit access rights for
99this group are not listed.
100+
101With this option you can find out on which projects a group is used.
102
Shawn O. Pearcea0418982012-04-05 09:10:02 -0700103HTTP
104----
105This command is also available over HTTP, as `/projects/` for
106anonymous access and `/a/projects/` for authenticated access.
Shawn O. Pearce5cd05772012-04-07 13:47:18 -0700107Named options are available as query parameters. Results can
108be limited to projects matching a prefix by supplying the prefix
109as part of the URL, for example `/projects/external/` lists only
110projects whose name start with the string `external/`.
Shawn O. Pearcea0418982012-04-05 09:10:02 -0700111
Shawn O. Pearceec9efd72012-04-04 20:44:39 -0700112Over HTTP the `json_compact` output format is assumed if the client
113explicitly asks for JSON using HTTP header `Accept: application/json`.
114When any JSON output format is used on HTTP, readers must skip the
115first line produced. The first line is a garbage JSON string crafted
116to prevent a browser from executing the response in a script tag.
117
118Output will be gzip compressed if `Accept-Encoding: gzip` was used
119by the client in the request headers.
120
Shawn O. Pearce4016a932009-05-28 15:12:40 -0700121EXAMPLES
122--------
123
124List visible projects:
125=====
126$ ssh -p 29418 review.example.com gerrit ls-projects
Shawn O. Pearce5cd05772012-04-07 13:47:18 -0700127platform/manifest
Shawn O. Pearce4016a932009-05-28 15:12:40 -0700128tools/gerrit
129tools/gwtorm
Shawn O. Pearcea0418982012-04-05 09:10:02 -0700130
131$ curl http://review.example.com/projects/
Shawn O. Pearce5cd05772012-04-07 13:47:18 -0700132platform/manifest
133tools/gerrit
134tools/gwtorm
135
136$ curl http://review.example.com/projects/tools/
Shawn O. Pearcea0418982012-04-05 09:10:02 -0700137tools/gerrit
138tools/gwtorm
Shawn O. Pearce4016a932009-05-28 15:12:40 -0700139=====
140
141Clone any project visible to the user:
142====
143for p in `ssh -p 29418 review.example.com gerrit ls-projects`
144do
145 mkdir -p `dirname "$p"`
146 git clone --bare "ssh://review.example.com:29418/$p.git" "$p.git"
147done
148====
149
150SEE ALSO
151--------
152
153* link:access-control.html[Access Controls]
Shawn O. Pearce5500e692009-05-28 15:55:01 -0700154
155GERRIT
156------
157Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -0700158
159SEARCHBOX
160---------