Skip to main content
Wir veröffentlichen regelmäßig Aktualisierungen unserer Dokumentation, und die Übersetzung dieser Seite ist möglicherweise noch nicht abgeschlossen. Aktuelle Informationen findest du in der englischsprachigen Dokumentation.

Schlüssel bereitstellen

Verwende die REST-API, um Bereitstellungsschlüssel zu erstellen und zu verwalten.

Informationen zu Bereitstellungsschlüsseln

Du kannst Projekte aus einem Repository in deine GitHub Enterprise Server-Instanz auf deinem Server starten, indem du einen Bereitstellungsschlüssel verwendest. Dabei handelt es sich um einen SSH-Schlüssel, der Zugriff auf ein einzelnes Repository gewährt. GitHub Enterprise Server fügt den öffentlichen Teil des Schlüssels direkt an dein Repository anstatt an dein persönliches Konto an, und der private Teil des Schlüssels verbleibt auf deinem Server. Weitere Informationen findest du unter Übermitteln von Bereitstellungen.

Die Bereitstellung von Schlüsseln kann entweder mithilfe der folgenden API-Endpunkte oder über GitHub eingerichtet werden. Weitere Informationen zum Einrichten von Bereitstellungsschlüsseln in GitHub findest du unter Verwalten von Bereitstellungsschlüsseln.

List deploy keys

Funktioniert mit GitHub Apps

Parameter für „List deploy keys“

Header
Name, type, BESCHREIBUNG
accept string

Setting to application/vnd.github+json is recommended.

Pfadparameter
Name, type, BESCHREIBUNG
owner string Erforderlich

The account owner of the repository. The name is not case sensitive.

repo string Erforderlich

The name of the repository. The name is not case sensitive.

Abfrageparameter
Name, type, BESCHREIBUNG
per_page integer

The number of results per page (max 100).

Standard: 30

page integer

Page number of the results to fetch.

Standard: 1

HTTP-Antwortstatuscodes für „List deploy keys“

StatuscodeBESCHREIBUNG
200

OK

Codebeispiele für „List deploy keys“

get/repos/{owner}/{repo}/keys
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/keys

Response

Create a deploy key

Funktioniert mit GitHub Apps

You can create a read-only deploy key.

Parameter für „Create a deploy key“

Header
Name, type, BESCHREIBUNG
accept string

Setting to application/vnd.github+json is recommended.

Pfadparameter
Name, type, BESCHREIBUNG
owner string Erforderlich

The account owner of the repository. The name is not case sensitive.

repo string Erforderlich

The name of the repository. The name is not case sensitive.

Textparameter
Name, type, BESCHREIBUNG
title string

A name for the key.

key string Erforderlich

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."

HTTP-Antwortstatuscodes für „Create a deploy key“

StatuscodeBESCHREIBUNG
201

Created

422

Validation failed, or the endpoint has been spammed.

Codebeispiele für „Create a deploy key“

post/repos/{owner}/{repo}/keys
curl -L \ -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/keys \ -d '{"title":"octocat@octomac","key":"ssh-rsa AAA...","read_only":true}'

Response

Status: 201
{ "id": 1, "key": "ssh-rsa AAA...", "url": "https://HOSTNAME/repos/octocat/Hello-World/keys/1", "title": "octocat@octomac", "verified": true, "created_at": "2014-12-10T15:53:42Z", "read_only": true }

Get a deploy key

Funktioniert mit GitHub Apps

Parameter für „Get a deploy key“

Header
Name, type, BESCHREIBUNG
accept string

Setting to application/vnd.github+json is recommended.

Pfadparameter
Name, type, BESCHREIBUNG
owner string Erforderlich

The account owner of the repository. The name is not case sensitive.

repo string Erforderlich

The name of the repository. The name is not case sensitive.

key_id integer Erforderlich

The unique identifier of the key.

HTTP-Antwortstatuscodes für „Get a deploy key“

StatuscodeBESCHREIBUNG
200

OK

404

Resource not found

Codebeispiele für „Get a deploy key“

get/repos/{owner}/{repo}/keys/{key_id}
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/keys/KEY_ID

Response

Status: 200
{ "id": 1, "key": "ssh-rsa AAA...", "url": "https://HOSTNAME/repos/octocat/Hello-World/keys/1", "title": "octocat@octomac", "verified": true, "created_at": "2014-12-10T15:53:42Z", "read_only": true }

Delete a deploy key

Funktioniert mit GitHub Apps

Deploy keys are immutable. If you need to update a key, remove the key and create a new one instead.

Parameter für „Delete a deploy key“

Header
Name, type, BESCHREIBUNG
accept string

Setting to application/vnd.github+json is recommended.

Pfadparameter
Name, type, BESCHREIBUNG
owner string Erforderlich

The account owner of the repository. The name is not case sensitive.

repo string Erforderlich

The name of the repository. The name is not case sensitive.

key_id integer Erforderlich

The unique identifier of the key.

HTTP-Antwortstatuscodes für „Delete a deploy key“

StatuscodeBESCHREIBUNG
204

No Content

Codebeispiele für „Delete a deploy key“

delete/repos/{owner}/{repo}/keys/{key_id}
curl -L \ -X DELETE \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/keys/KEY_ID

Response

Status: 204