summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Vosmaer <jacob@gitlab.com>2014-05-20 16:19:09 +0000
committerJacob Vosmaer <jacob@gitlab.com>2014-05-20 16:19:09 +0000
commit3199ef079c0cb4fdcd2b549399c8f4d624133719 (patch)
tree41573b458a2046140ca7a9a6748dc2ae9bb1a681
parentd52a3281dccefa5fcb774b9f0314abba7edfc820 (diff)
parentea109704d10d7fc5e9808e5355df994a7f6e109b (diff)
downloadgitlab-ce-3199ef079c0cb4fdcd2b549399c8f4d624133719.tar.gz
Merge branch 'deploy-key-projects' into 'master'
Deploy key in multiple projects Add doc on adding a deploy key easily to multiple projects through the API.
-rw-r--r--doc/api/deploy_key_multiple_projects.md25
1 files changed, 25 insertions, 0 deletions
diff --git a/doc/api/deploy_key_multiple_projects.md b/doc/api/deploy_key_multiple_projects.md
new file mode 100644
index 00000000000..1a5a458905e
--- /dev/null
+++ b/doc/api/deploy_key_multiple_projects.md
@@ -0,0 +1,25 @@
+# Adding deploy keys to multiple projects
+
+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.
+
+First, find the ID of the projects you're interested in, by either listing all projects:
+
+```
+curl --header 'PRIVATE-TOKEN: abcdef' https://gitlab.com/api/v3/projects
+```
+
+Or finding the id of a group and then listing all projects in that group:
+
+```
+curl --header 'PRIVATE-TOKEN: abcdef' https://gitlab.com/api/v3/groups
+
+# For group 1234:
+curl --header 'PRIVATE-TOKEN: abcdef' https://gitlab.com/api/v3/groups/1234
+```
+
+With those IDs, add the same deploy key to all:
+```
+for project_id in 321 456 987; do
+ curl -X POST --data '{"title": "my key", "key": "ssh-rsa AAAA..."}' --header 'PRIVATE-TOKEN: abcdef' https://gitlab.com/api/v3/projects/${project_id}/keys
+done
+```