> For the complete documentation index, see [llms.txt](https://manual.dxable.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://manual.dxable.com/1password/use-shell-plugins-to-authenticate-with-multiple-accounts.md).

# シェルプラグインを使用して複数のアカウントで認証する

### **シェルプラグインを使って複数のアカウントで認証する** <a href="#hoteqymlg1yp" id="hoteqymlg1yp"></a>

[1Password Shell プラグイン](https://developer.1password.com/docs/cli/shell-plugins/)を設定して、異なるディレクトリー内の異なるアカウントで認証することができるため、プロジェクト間でサインインまたはサインアウトする時間を費やす必要がありません。

例えば、GitHubシェルプラグインを設定して、Create業リポジトリーのディレクトリーではCreate業用の資格情報を使って認証し、個人リポジトリーのディレクトリーでは個人用の資格情報を使って認証することができます。

### **ステップ 1：アカウント**ごとにディレクトリーを整理する <a href="#rm6e7sw6f80n" id="rm6e7sw6f80n"></a>

複数のアカウントを使うようにシェルプラグインを設定する前に、使うアカウントごとにコンピューター上のプロジェクトのディレクトリーをグループ化します。

例えば、個人用と仕事用のGitHubアカウントがある場合、個人用と仕事用のGitHubリポジトリーフォルダーを次のように整理します。

![](/files/qYEDUBKJVv2asMbH92Lj)

### **ステップ 2：各環境用のデフォルトの資格情報を設定する** <a href="#gqcyeylimy1j" id="gqcyeylimy1j"></a>

プロジェクトをアカウントレベルのディレクトリーに整理したら、各ディレクトリーとその全てのサブフォルダで使うシェルプラグインのデフォルトの資格情報を設定できます。

1. Createしたアカウントレベルのフォルダーの1つにディレクトリーを変更します。\
   例：\
   $ cd projects/work
2. 使用したい資格情報がSaveされている 1Passwordアカウントにサインインします。\
   $ op signin
3. 初期化するプラグインを選択するか、op plugin initを実行して利用可能な全プラグインのリストから選択します。例えば、GitHubプラグインを初期化するには、次のようにします。\
   $ op plugin init gh
4. アカウントで使う適切な資格情報をインポートまたは選択します。
5. デフォルトの資格情報スコープとして、「Use automatically when in this directory or subdirectories 」を選択します。
6. それぞれの資格情報を使って、他のアカウントレベルのフォルダーでこのプロセスを繰り返します。

これにより、他のディレクトリー固有のデフォルトが設定されていない限り、各アカウント レベルのフォルダーで設定した資格情報が、そのフォルダー内の全てのサブフォルダーのデフォルトになります。

全てのアカウント レベルのフォルダーでデフォルトを設定したら、全てのプロジェクトで通常どおりにシェルプラグインを使います。個人ディレクトリーまたはCreate業ディレクトリー内のフォルダーでプラグインを使うと、プラグインは適切な資格情報を使って自動的に認証します。

### **さらに詳しく知るには** <a href="#id-7cwco8j6qdux" id="id-7cwco8j6qdux"></a>

* [1Password Shellプラグインを使い始める](https://developer.1password.com/docs/cli/shell-plugins/)
* [独自のシェルプラグインを構築する](https://developer.1password.com/docs/cli/shell-plugins/contribute/)


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://manual.dxable.com/1password/use-shell-plugins-to-authenticate-with-multiple-accounts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
