> For the complete documentation index, see [llms.txt](https://help.aikido.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.aikido.dev/docs/docs-ja/autofix-to/configure/autofix-for-gitlab-with-deploy-keys.md).

# デプロイキーを使用した GitLab 向け AutoFix

デプロイキーを設定して、AutoFix が Personal Access Token（PAT）を使用する代わりに SSH 経由で GitLab リポジトリにプッシュできるようにします。

## なぜデプロイキーを使うのですか？

デプロイキーは、GitLabグループで署名付きコミットとシングルサインオン（SSO）の両方を強制している場合に必要です。SSOが強制されていると、GitLabはgit pushのたびにPATの再認可を定期的に要求します。デプロイキーはSSOセッションに紐づかないため、AutoFixは引き続き動作します。

## 仕組み

選択した各リポジトリごとに、Aikidoは専用のSSH鍵ペアを生成し、公開鍵をaikido-autofix-deploy-keyという名前のデプロイキーとして、そのGitLabプロジェクトに書き込み権限付きで登録します。秘密鍵はAikidoによって暗号化されて保存されます。その後、AutoFixはデプロイキーを使ってコミットをプッシュします。

PATは引き続き必要です。AikidoはGitLab APIを通じてデプロイキーを追加・削除し、マージリクエストを作成するためにPATを使用します。

## 前提条件

* あなたはAikidoの管理者です。
* 有効なAutoFixのPersonal Access Token（PAT）が設定されています。
* PATのGitLabユーザーには、選択したプロジェクトにデプロイキーを追加する権限があります。

### デプロイキーを有効にする

1. Aikido で次へ移動します: [GitLabトークンの設定](https://app.aikido.dev/onboarding/gitlab/update-workspace-access-token)、AutoFixタブを開き、［詳細設定］を展開します。

<img src="https://715870456-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyKbzcQGrx7UtrG0nPZZ7%2Fuploads%2FpXaNW6lhy8ryRUdxElte%2Funknown.png?alt=media&amp;token=71817876-e83f-4021-aaca-e1f2fd92c6ea" alt="" height="254" width="856">

2. ［デプロイキー］で［リポジトリ］フィールドを開き、AutoFixがデプロイキーを使用してSSH経由でプッシュするリポジトリを選択します。
3. ［リポジトリにデプロイキーを追加］をクリックします。

［リポジトリを更新中］ダイアログが完了するまで待ちます。

## デプロイキーを削除する

1. Aikido で次へ移動します: [GitLabトークンの設定](https://app.aikido.dev/onboarding/gitlab/update-workspace-access-token)、AutoFixタブを開き、［詳細設定］を展開します。
2. 削除したいリポジトリの選択を解除します。
3. ［リポジトリからデプロイキーを削除］をクリックし、確認します。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.aikido.dev/docs/docs-ja/autofix-to/configure/autofix-for-gitlab-with-deploy-keys.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
