blob: fb35dc2227287e5f36b0ad3fd328bf7b6a939ba0 [file] [log] [blame]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001= gerrit ls-projects
Shawn O. Pearce4016a932009-05-28 15:12:40 -07002
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003== NAME
David Shevitze369eee2018-09-26 12:31:46 -07004gerrit ls-projects - List projects visible to caller.
Shawn O. Pearce4016a932009-05-28 15:12:40 -07005
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006== SYNOPSIS
Michael Ochmanne2d76a12016-06-23 17:07:37 +02007[verse]
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08008--
Michael Ochmanne2d76a12016-06-23 17:07:37 +02009_ssh_ -p <port> <host> _gerrit ls-projects_
Shawn O. Pearce47769242011-06-14 16:40:48 -070010 [--show-branch <BRANCH> ...]
Edwin Kempin73b26982012-07-16 13:53:22 +020011 [--description | -d]
12 [--tree | -t]
Shawn O. Pearce47769242011-06-14 16:40:48 -070013 [--type {code | permissions | all}]
Edwin Kempin73b26982012-07-16 13:53:22 +020014 [--format {text | json | json_compact}]
15 [--all]
16 [--limit <N>]
Luca Milanesio85b4b3e2019-01-28 23:14:14 +000017 [--prefix | -p <prefix>]
Edwin Kempinf0c70422012-08-24 15:34:20 +020018 [--has-acl-for GROUP]
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -080019--
Shawn O. Pearce4016a932009-05-28 15:12:40 -070020
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080021== DESCRIPTION
Shawn O. Pearce4016a932009-05-28 15:12:40 -070022Displays the list of project names, one per line, that the
23calling user account has been granted 'READ' access to.
24
25If the caller is a member of the privileged 'Administrators'
26group, all projects are listed.
27
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080028== ACCESS
Gert van Dijkdc4f8d12017-08-27 21:14:23 +020029Any user who has SSH access to Gerrit.
Shawn O. Pearce4016a932009-05-28 15:12:40 -070030
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080031== SCRIPTING
Shawn O. Pearce4016a932009-05-28 15:12:40 -070032This command is intended to be used in scripts.
33
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080034== OPTIONS
Shawn O. Pearce47769242011-06-14 16:40:48 -070035--show-branch::
36-b::
Anatol Pomazau37395692011-05-24 06:50:38 -070037 Branch for which the command will display the sha of each project.
Shawn O. Pearce47769242011-06-14 16:40:48 -070038 The command may have multiple --show-branch parameters, in this case
Anatol Pomazau37395692011-05-24 06:50:38 -070039 sha will be shown for each of the branches.
40 If the user does not have READ access to some branch or the branch does not
Shawn O. Pearce47769242011-06-14 16:40:48 -070041 exist then stub (40 `-` symbols) is shown.
Anatol Pomazau37395692011-05-24 06:50:38 -070042 If the user does not have access to any branch in the project then the
43 whole project is not shown.
Nico Sallembien0d6312d2010-03-15 14:48:44 -070044
Gustaf Lundh87cea022011-09-01 15:56:59 +020045--description::
Edwin Kempin73b26982012-07-16 13:53:22 +020046-d::
Gustaf Lundh87cea022011-09-01 15:56:59 +020047 Allows listing of projects together with their respective
48 description.
Edwin Kempin9ad27612011-11-21 10:59:25 +010049+
Magnus Bäck21f533a2012-03-22 09:55:03 -040050For text format output, all non-printable characters (ASCII value 31 or
51less) are escaped according to the conventions used in languages like C,
52Python, and Perl, employing standard sequences like `\n` and `\t`, and
53`\xNN` for all others. In shell scripts, the `printf` command can be
54used to unescape the output.
Gustaf Lundh87cea022011-09-01 15:56:59 +020055
Shawn O. Pearce47769242011-06-14 16:40:48 -070056--tree::
57-t::
lincoln5bfabe52010-05-31 16:23:53 -030058 Displays project inheritance in a tree-like format.
59 This option does not work together with the show-branch option.
60
Shawn O. Pearce7fdf53e2011-06-14 14:52:59 -070061--type::
Shawn O. Pearce47769242011-06-14 16:40:48 -070062 Display only projects of the specified type. If not
Hugo Arès7e45a462016-03-02 14:11:05 -050063 specified, defaults to `all`. Supported types:
Shawn O. Pearce7b825b32012-04-05 09:10:41 -070064+
65--
66`code`:: Any project likely to contain user files.
67`permissions`:: Projects created with the `--permissions-only` flag.
68`all`:: Any type of project.
69--
Edwin Kempinf179be22011-09-22 14:34:02 +020070
Shawn O. Pearceec9efd72012-04-04 20:44:39 -070071--format::
72 What output format to display the results in.
73+
74--
75`text`:: Simple text based format.
76`json`:: Map of JSON objects describing each project.
77`json_compact`:: Minimized JSON output.
78--
79
Edwin Kempinf179be22011-09-22 14:34:02 +020080--all::
81 Display all projects that are accessible by the calling user
82 account. Besides the projects that the calling user account has
83 been granted 'READ' access to, this includes all projects that
84 are owned by the calling user account (even if for these projects
85 the 'READ' access right is not assigned to the calling user
86 account).
Shawn O. Pearce7fdf53e2011-06-14 14:52:59 -070087
Shawn O. Pearce5cd05772012-04-07 13:47:18 -070088--limit::
89 Cap the number of results to the first N matches.
90
Luca Milanesio85b4b3e2019-01-28 23:14:14 +000091--prefix::
92 Limit the results to those projects that start with the specified prefix.
93
Edwin Kempinf0c70422012-08-24 15:34:20 +020094--has-acl-for::
95 Display only projects on which access rights for this group are
96 directly assigned. Projects which only inherit access rights for
97 this group are not listed.
98+
99With this option you can find out on which projects a group is used.
100
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800101== HTTP
Shawn O. Pearcea0418982012-04-05 09:10:02 -0700102This command is also available over HTTP, as `/projects/` for
103anonymous access and `/a/projects/` for authenticated access.
Shawn O. Pearce5cd05772012-04-07 13:47:18 -0700104Named options are available as query parameters. Results can
105be limited to projects matching a prefix by supplying the prefix
106as part of the URL, for example `/projects/external/` lists only
107projects whose name start with the string `external/`.
Shawn O. Pearcea0418982012-04-05 09:10:02 -0700108
Shawn O. Pearceec9efd72012-04-04 20:44:39 -0700109Over HTTP the `json_compact` output format is assumed if the client
110explicitly asks for JSON using HTTP header `Accept: application/json`.
111When any JSON output format is used on HTTP, readers must skip the
112first line produced. The first line is a garbage JSON string crafted
113to prevent a browser from executing the response in a script tag.
114
115Output will be gzip compressed if `Accept-Encoding: gzip` was used
116by the client in the request headers.
117
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800118== EXAMPLES
Shawn O. Pearce4016a932009-05-28 15:12:40 -0700119
120List visible projects:
Michael Ochmannb99feab2016-07-06 14:10:22 +0200121----
David Shevitze369eee2018-09-26 12:31:46 -0700122$ ssh -p 29418 review.example.com gerrit ls-projects
123platform/manifest
124tools/gerrit
125tools/gwtorm
Shawn O. Pearcea0418982012-04-05 09:10:02 -0700126
David Shevitze369eee2018-09-26 12:31:46 -0700127$ curl http://review.example.com/projects/
128platform/manifest
129tools/gerrit
130tools/gwtorm
Shawn O. Pearce5cd05772012-04-07 13:47:18 -0700131
David Shevitze369eee2018-09-26 12:31:46 -0700132$ curl http://review.example.com/projects/tools/
133tools/gerrit
134tools/gwtorm
Michael Ochmannb99feab2016-07-06 14:10:22 +0200135----
Shawn O. Pearce4016a932009-05-28 15:12:40 -0700136
137Clone any project visible to the user:
Michael Ochmannb99feab2016-07-06 14:10:22 +0200138----
David Shevitze369eee2018-09-26 12:31:46 -0700139for p in `ssh -p 29418 review.example.com gerrit ls-projects`
140do
141 mkdir -p `dirname "$p"`
142 git clone --bare "ssh://review.example.com:29418/$p.git" "$p.git"
143done
Michael Ochmannb99feab2016-07-06 14:10:22 +0200144----
Shawn O. Pearce4016a932009-05-28 15:12:40 -0700145
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800146== SEE ALSO
Shawn O. Pearce4016a932009-05-28 15:12:40 -0700147
148* link:access-control.html[Access Controls]
Shawn O. Pearce5500e692009-05-28 15:55:01 -0700149
150GERRIT
151------
152Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -0700153
154SEARCHBOX
155---------