このバージョンの GitHub Enterprise はこの日付をもって終了となりました: 2023-03-15. 重大なセキュリティの問題に対してであっても、パッチリリースは作成されません。 パフォーマンスの向上、セキュリティの向上、新機能の向上を図るために、最新バージョンの GitHub Enterprise にアップグレードします。 アップグレードに関するヘルプについては、GitHub Enterprise サポートにお問い合わせください。
Gitignore
REST API を使用して、ファイルとディレクトリを無視するために使用できる .gitignore
テンプレートを取得します。
gitignore について
この API を使って お使いの GitHub Enterprise Server インスタンス に新しいリポジトリを作成する場合、作成時にリポジトリに適用する .gitignore テンプレートを指定できます。 REST API を使って、GitHub Enterprise Server .gitignore リポジトリから .gitignore テンプレートを取得できます。
gitignore テンプレートを取得するときに、この application/vnd.github.raw
カスタム メディア タイプを使用できます。 詳しくは、「メディアの種類」を参照してください。
Get all gitignore templates
List all templates available to pass as an option when creating a repository.
"Get all gitignore templates" の HTTP 応答状態コード
状態コード | 説明 |
---|---|
200 | OK |
304 | Not modified |
"Get all gitignore templates" のコード サンプル
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/gitignore/templates
Response
Status: 200
[
"Actionscript",
"Android",
"AppceleratorTitanium",
"Autotools",
"Bancha",
"C",
"C++"
]
Get a gitignore template
The API also allows fetching the source of a single template. Use the raw media type to get the raw contents.
"Get a gitignore template" のパラメーター
ヘッダー |
---|
名前, Type, 説明 |
accept string Setting to |
パス パラメーター |
名前, Type, 説明 |
name string 必須 |
"Get a gitignore template" の HTTP 応答状態コード
状態コード | 説明 |
---|---|
200 | OK |
304 | Not modified |
"Get a gitignore template" のコード サンプル
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/gitignore/templates/NAME
Response
Status: 200
{
"name": "C",
"source": "# Object files\n*.o\n\n# Libraries\n*.lib\n*.a\n\n# Shared objects (inc. Windows DLLs)\n*.dll\n*.so\n*.so.*\n*.dylib\n\n# Executables\n*.exe\n*.out\n*.app\n"
}