Commit f0a4f62c7eb0900ca1c3cdecffbacc46a72480d2
1 parent
2bfd95d8
Exists in
spb-stable
and in
2 other branches
start writing deploy key to multiple projects
Showing
1 changed file
with
22 additions
and
0 deletions
Show diff stats
| @@ -0,0 +1,22 @@ | @@ -0,0 +1,22 @@ | ||
| 1 | +# Adding deploy keys to multiple projects | ||
| 2 | + | ||
| 3 | +If you want to easily add the same deploy key to multiple projects in the same group, this can be achieved quite easily with the API. | ||
| 4 | + | ||
| 5 | +First, find the ID of the projects you're interested in, by either listing all projects: | ||
| 6 | + | ||
| 7 | +``` | ||
| 8 | +curl https://gitlab.com/api/v3/projects?private_token=abcdef | ||
| 9 | +``` | ||
| 10 | + | ||
| 11 | +Or finding the id of a group and then listing all projects in that group: | ||
| 12 | + | ||
| 13 | +``` | ||
| 14 | +curl https://gitlab.com/api/v3/groups?private_token=abcdef | ||
| 15 | + | ||
| 16 | +curl https://gitlab.com/api/v3/groups/1234?private_token=abcdef # where the id of the group is 1234 | ||
| 17 | +``` | ||
| 18 | + | ||
| 19 | +With those IDs, add the same deploy key to all: | ||
| 20 | +``` | ||
| 21 | +curl -X POST curl https://gitlab.com/api/v3/projects/321/deploy_key_here?private_token=abcdef | ||
| 22 | +``` |