Blame
|
1 | # Repository Management |
||||||
| 2 | ||||||||
| 3 | > [!WARNING] |
|||||||
| 4 | > The following features are experimental and may cause unexpected behavior. Use them carefully and report any issues you encounter. |
|||||||
| 5 | ||||||||
| 6 | The **Repository Management** page under **Settings** allows you to configure various ways to manage your wiki repository, including HTTP access for users, automated pushes on every wiki change, and automatic pulls when external changes occur. |
|||||||
| 7 | ||||||||
| 8 | ||||||||
| 9 | ## Git Web Server |
|||||||
| 10 | ||||||||
| 11 | Enabling Git Web Server allows users to access wiki contents as a regular git repository via HTTP. Users with `READ` permission can pull changes, while users with `UPLOAD` permission can push changes as well. |
|||||||
| 12 | ||||||||
| 13 | ||||||||
| 14 | ## Pushing to and Pulling from SSH Remote |
|||||||
| 15 | ||||||||
| 16 | You can enable automatic pushing to or pulling from a pre-defined git remote whenever changes occur on either side. Both settings are not connected to each other in any way and only one or both could be enabled when needed. |
|||||||
| 17 | ||||||||
| 18 | In both cases, you must define the git remote address at minimum. Note that only SSH remotes are currently supported. |
|||||||
| 19 | ||||||||
| 20 | For authorization, An Otter Wiki supports SSH keys as the most secure and straightforward method. Alternatively, you can configure authorization externally (on your host system if running An Otter Wiki natively, or inside the container), make sure that `ssh` command can authenticate with the remote server. |
|||||||
| 21 | ||||||||
| 22 | When setting up automated pulls, note the generated webhook URL - it's unique to each remote URL. If you change your remote URL, get the new webhook URL as well. |
|||||||
| 23 | ||||||||
| 24 | Both push and pull configurations add buttons at the bottom right of the page, allowing you to test your settings. |
|||||||
| 25 | ||||||||
|
26 | [](./repository-management-actions.png) |
||||||
| 27 | ||||||||
|
28 | ### GitHub Example |
||||||
| 29 | ||||||||
| 30 | This example shows how to set up automatic pushing and pulling between your wiki and a GitHub repository `user/wiki`, including SSH key authorization. |
|||||||
| 31 | ||||||||
| 32 | First, get the remote URL from GitHub, for this example it will be `git@github.com:user/wiki.git`. |
|||||||
| 33 | ||||||||
| 34 | #### Authorization with SSH Key |
|||||||
| 35 | ||||||||
| 36 | 1. Generate a new SSH key using `ssh-keygen -t ed25519 -f mywiki` |
|||||||
| 37 | 2. You'll get two files after that: `mywiki` (private key) and `mywiki.pub` (public key) |
|||||||
| 38 | 3. Go to your GitHub repository > **Settings** > **Deploy keys** > **Add deploy key** |
|||||||
| 39 | 4. Paste your public key (`cat mywiki.pub`) into the **Key** field |
|||||||
| 40 | 5. Check **Allow write access** if you plan to enable automatic pushes |
|||||||
|
41 | 6. Click **Add key** to save |
||||||
|
42 | |||||||
|
43 | [](./github-add-deploy-key.png) |
||||||
| 44 | ||||||||
|
45 | > [!TIP] |
||||||
| 46 | > For security reasons, you can safely delete the local key files (`mywiki` and `mywiki.pub`) after completing this setup, since An Otter Wiki stores the private key and GitHub stores the public key. |
|||||||
| 47 | ||||||||
| 48 | #### Automatic Pushing |
|||||||
| 49 | ||||||||
| 50 | 1. Check **Enable pushing to SSH remote** |
|||||||
| 51 | 2. Paste your GitHub remote URL in the **SSH Remote URL** field |
|||||||
| 52 | 3. Paste your private key (`cat mywiki`) in the **SSH Private Key (Optional)** field |
|||||||
| 53 | 4. Click **Save Preferences** |
|||||||
| 54 | 5. Click **Push** in the bottom right to test pushing existing changes to the remote |
|||||||
| 55 | 6. If successful, try editing or creating a page in your wiki - changes should immediately appear on GitHub |
|||||||
| 56 | ||||||||
| 57 | #### Automatic Pulling |
|||||||
| 58 | ||||||||
| 59 | 1. Check **Enable pulling from SSH remote** |
|||||||
| 60 | 2. Paste your GitHub remote URL in the **SSH Remote URL** field |
|||||||
| 61 | 3. Paste your private key (`cat mywiki`) in the **SSH Private Key (Optional)** field |
|||||||
| 62 | 4. Click **Save Preferences** |
|||||||
| 63 | 5. Click **Pull** in the bottom right to test pulling existing changes from the remote |
|||||||
| 64 | 6. If successful, copy the webhook URL from the **Pull webhook URL** field |
|||||||
| 65 | 7. Go to your GitHub repository > **Settings** > **Webhooks** > **Add webhook** |
|||||||
| 66 | 8. Paste the webhook URL into the **Payload URL** field and select `application/json` as the **Content type** |
|||||||
| 67 | 9. Click **Add webhook** to save |
|||||||
| 68 | 10. Test by editing or creating a file on the GitHub side - changes should be immediately pulled into the wiki |
|||||||
|
69 | |||||||
| 70 | [](./github-add-webhook.png) |
|||||||
