POST /repos/:owner/:repo/keys
| Name | Type | Description |
|---|---|---|
title |
string |
A name for the key. |
key |
string |
Required. The contents of the key. |
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.Deploy keys with write access can perform the same actions as an organization member with admin access, or a collaborator on a personal repository. For more information, see "Repository permission levels for an organization" and "Permission levels for a user account repository." |
Here's how you can create a read-only deploy key:
{
"title": "octocat@octomac",
"key": "ssh-rsa AAA...",
"read_only": true
}
Status: 201 Created
Location: https://api.github.com/repos/octocat/Hello-World/keys/1
{
"id": 1,
"key": "ssh-rsa AAA...",
"url": "https://api.github.com/repos/octocat/Hello-World/keys/1",
"title": "octocat@octomac",
"verified": true,
"created_at": "2014-12-10T15:53:42Z",
"read_only": true
}