This repository was archived by the owner on Nov 1, 2017. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -65,11 +65,11 @@ A deploy key is an SSH key that is stored on your server and grants access to a
6565
6666* Anyone with access to the repository and server has the ability to deploy the project.
6767* Users don't have to change their local SSH settings.
68+ * Deploy keys can read and write by default, but can be made read-only.
6869
6970#### Cons
7071
7172* Deploy keys only grant access to a single repository. More complex projects may have many repositories to pull to the same server.
72- * Deploy keys always provide full read/write access to a repository.
7373* Deploy keys are usually not protected by a passphrase, making the key easily accessible if the server is compromised.
7474
7575#### Setup
Original file line number Diff line number Diff line change @@ -29,9 +29,19 @@ title: Deploy Keys | GitHub API
2929
3030 POST /repos/:owner/:repo/keys
3131
32- ### Input
32+ ### Parameters
3333
34- <%= json : title => "octocat@octomac", : key => "ssh-rsa AAA..." %>
34+ Name | Type | Description
35+ -----|------|-------------
36+ ` title ` |` string ` |A name for the key.
37+ ` key ` |` string ` |The contents of the key.
38+ ` read_only ` |` boolean ` |If ` true ` , the key will only be able to read repository contents. Otherwise, the key will be able to read and write.
39+
40+ #### Example
41+
42+ Here's how you can create a read-only deploy key:
43+
44+ <%= json : title => "octocat@octomac", : key => "ssh-rsa AAA...", : read_only => true %>
3545
3646### Response
3747
Original file line number Diff line number Diff line change @@ -217,13 +217,15 @@ def fetch_content(key)
217217 "url" => "https://api.github.com/user/keys/1" ,
218218 "title" => "octocat@octomac" ,
219219 "verified" => true ,
220- "created_at" => "2014-12-10T15:53:42Z"
220+ "created_at" => "2014-12-10T15:53:42Z" ,
221+ "read_only" => true
221222
222223 DEPLOY_KEY ||= SIMPLE_PUBLIC_KEY . merge \
223224 "url" => "https://api.github.com/repos/octocat/Hello-World/keys/1" ,
224225 "title" => "octocat@octomac" ,
225226 "verified" => true ,
226- "created_at" => "2014-12-10T15:53:42Z"
227+ "created_at" => "2014-12-10T15:53:42Z" ,
228+ "read_only" => true
227229
228230 SIMPLE_REPO ||= {
229231 "id" => 1296269 ,
You can’t perform that action at this time.
0 commit comments