# 在自托管网站上安装插件

**URL:** <https://meta.discourse.org/t/install-plugins-on-a-self-hosted-site/19157>\
**Category:** Self-Hosting\
**Tags:** how-to\
**Created:** [2014年八月22日 02:59 UTC](https://meta.discourse.org/t/install-plugins-on-a-self-hosted-site/19157 "2014-08-22T02:59:12Z")\
**Posts on this page:** 1\
**Showing post:** 349

<div class="post-metadata">

**Author:** ![Overgrow](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/overgrow/32/478189_2.png) [@Overgrow](https://meta.discourse.org/u/Overgrow)\
**Post date:** [2024年九月2日 16:38 UTC](https://meta.discourse.org/t/install-plugins-on-a-self-hosted-site/19157/349 "2024-09-02T16:38:48Z")

</div>

> [@Discourse](#):
>
> SSH 密钥私有安装步骤

@Discourse，如果您想更新指南，这是可行的代码：

要使用您自己的 SSH 密钥访问私有存储库，请按照以下步骤操作：

1. 将私有 SSH 密钥放在 `/var/discourse/shared/standalone/identity/id_rsa`（或容器可访问的其他位置；如果您选择其他位置，请记住在下面的模板中相应地更新路径）。

2. 使用以下模板添加您的插件：

```plaintext
hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          # 设置私有存储库访问
          - chown $(whoami) /shared/identity/id_rsa && chmod 600 /shared/identity/id_rsa
          - git config --global core.sshCommand "ssh -o StrictHostKeyChecking=no -o IdentitiesOnly=yes -i /shared/identity/id_rsa"

          # 我的私有插件
          - git clone git@example.com:repo/private-discourse-plugin.git

          # 取消设置访问
          - git config --global --unset core.sshCommand

```

---

_[View the full topic](https://meta.discourse.org/t/install-plugins-on-a-self-hosted-site/19157)._
