[GH-ISSUE #308] Failing to sync mirrored external repo #5812

Closed
opened 2026-06-21 21:46:49 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @Vrend on GitHub (May 31, 2026).
Original GitHub issue: https://github.com/RayLabsHQ/gitea-mirror/issues/308

Originally assigned to: @arunavo4 on GitHub.

Hello,

I am currently hosting my gitea-mirror instance in a docker container, with my gitea instance also dockerized on the same host.

I am trying to create a mirror of an external repository that syncs regularly (with snapshot backups) for a public repo I am not an owner/contributor of.

I am able to initially create the mirror, but I am unable to sync when the repo updates on github. The activity log gives this error:

Image

My docker log has the following error:

2026-05-31 19:22:15.747636+00:00[Sync] Starting sync for repository dads-mmo-lab
2026-05-31 19:22:16.145085+00:00GET /repos/DadsMmoLab/dads-mmo-lab/branches?per_page=100 - 200 with id 8F8B:4FD31:65D2BA:181EBB4:6A1C8A63 in 149ms
2026-05-31 19:22:16.767326+00:00GET /repos/DadsMmoLab/dads-mmo-lab/compare/7c6d273fec353fbfbdf532f6e9af382f76d897bc...df2b645b0bebcaebbeab8d0e9f9845f225b35f6f - 200 with id 8F8B:4FD31:65D3C3:181EFCB:6A1C8A68 in 613ms
2026-05-31 19:22:16.769746+00:00[Sync] Updating mirror interval for github-personal/dads-mmo-lab to 8h
2026-05-31 19:22:16.900198+00:00[Sync] Successfully updated mirror interval for github-personal/dads-mmo-lab
2026-05-31 19:22:16.948726+00:00[Sync] Error while syncing repository dads-mmo-lab: 45 |         console.error(`[HTTP Client] Response: ${responseText}`);
2026-05-31 19:22:16.948787+00:0046 |         if (responseText.includes("user does not exist") && responseText.includes("uid: 0")) {
2026-05-31 19:22:16.948806+00:0047 |           console.error(`[HTTP Client] Token appears to be invalid or the user account is not properly configured in Gitea`);
2026-05-31 19:22:16.948820+00:0048 |         }
2026-05-31 19:22:16.948833+00:0049 |       }
2026-05-31 19:22:16.948846+00:0050 |       throw new HttpError(
2026-05-31 19:22:16.948859+00:00^
2026-05-31 19:22:16.948871+00:00HttpError: HTTP 405: Method Not Allowed
2026-05-31 19:22:16.948883+00:00status: 405,
2026-05-31 19:22:16.948895+00:00statusText: "Method Not Allowed",
2026-05-31 19:22:16.948907+00:00response: "",
2026-05-31 19:22:16.948920+00:002026-05-31T19:22:16.948920222Z
2026-05-31 19:22:16.948932+00:00at httpRequest (/app/dist/server/chunks/utils_DEEuWbId.mjs:50:13)
2026-05-31 19:22:16.948978+00:002026-05-31T19:22:16.948978174Z
2026-05-31 19:22:17.018803+00:00Publishing event to channel mirror-status:h9p6LkWT68BSX4eQ1Q84EeceAOytYnSi for user h9p6LkWT68BSX4eQ1Q84EeceAOytYnSi
2026-05-31 19:22:17.044937+00:00Event published successfully with ID 078dfc40-cedb-49da-ac45-41ba53f5e784
2026-05-31 19:22:17.046881+00:00=== ITEM PROCESSING FAILED (MAX RETRIES EXCEEDED) ===
2026-05-31 19:22:17.046977+00:00Item: unknown
2026-05-31 19:22:17.047008+00:00Error type: Error
2026-05-31 19:22:17.047033+00:00Error message: Failed to sync repository: HTTP 405: Method Not Allowed
2026-05-31 19:22:17.047058+00:00Attempts made: 3
2026-05-31 19:22:17.046975+00:00Retry progress: 100% (1/1)
2026-05-31 19:22:17.047157+00:00All repository retry tasks completed
2026-05-31 19:22:17.047093+00:00Stack trace: Error: Failed to sync repository: HTTP 405: Method Not Allowed
2026-05-31 19:22:17.047210+00:00at <anonymous> (/app/dist/server/chunks/gitea_BIHki0HJ.mjs:1384:17)
2026-05-31 19:22:17.047234+00:00at processTicksAndRejections (native:7:39)
2026-05-31 19:22:17.047255+00:00================================================
2026-05-31 19:22:17.047275+00:00=== BATCH ITEM PROCESSING ERROR ===
2026-05-31 19:22:17.047296+00:00Batch index: 0
2026-05-31 19:22:17.047316+00:00Item index in batch: 0
2026-05-31 19:22:17.047336+00:00Global item index: 0
2026-05-31 19:22:17.047356+00:00Error type: Error
2026-05-31 19:22:17.047375+00:00Error message: Failed to sync repository: HTTP 405: Method Not Allowed
2026-05-31 19:22:17.047396+00:00==================================

These are the permissions of my gitea token:

Image
Originally created by @Vrend on GitHub (May 31, 2026). Original GitHub issue: https://github.com/RayLabsHQ/gitea-mirror/issues/308 Originally assigned to: @arunavo4 on GitHub. Hello, I am currently hosting my gitea-mirror instance in a docker container, with my gitea instance also dockerized on the same host. I am trying to create a mirror of an external repository that syncs regularly (with snapshot backups) for a public repo I am not an owner/contributor of. I am able to initially create the mirror, but I am unable to sync when the repo updates on github. The activity log gives this error: <img width="1306" height="229" alt="Image" src="https://github.com/user-attachments/assets/7e13917e-830a-4241-ba98-e9c53708faf6" /> My docker log has the following error: ``` 2026-05-31 19:22:15.747636+00:00[Sync] Starting sync for repository dads-mmo-lab 2026-05-31 19:22:16.145085+00:00GET /repos/DadsMmoLab/dads-mmo-lab/branches?per_page=100 - 200 with id 8F8B:4FD31:65D2BA:181EBB4:6A1C8A63 in 149ms 2026-05-31 19:22:16.767326+00:00GET /repos/DadsMmoLab/dads-mmo-lab/compare/7c6d273fec353fbfbdf532f6e9af382f76d897bc...df2b645b0bebcaebbeab8d0e9f9845f225b35f6f - 200 with id 8F8B:4FD31:65D3C3:181EFCB:6A1C8A68 in 613ms 2026-05-31 19:22:16.769746+00:00[Sync] Updating mirror interval for github-personal/dads-mmo-lab to 8h 2026-05-31 19:22:16.900198+00:00[Sync] Successfully updated mirror interval for github-personal/dads-mmo-lab 2026-05-31 19:22:16.948726+00:00[Sync] Error while syncing repository dads-mmo-lab: 45 | console.error(`[HTTP Client] Response: ${responseText}`); 2026-05-31 19:22:16.948787+00:0046 | if (responseText.includes("user does not exist") && responseText.includes("uid: 0")) { 2026-05-31 19:22:16.948806+00:0047 | console.error(`[HTTP Client] Token appears to be invalid or the user account is not properly configured in Gitea`); 2026-05-31 19:22:16.948820+00:0048 | } 2026-05-31 19:22:16.948833+00:0049 | } 2026-05-31 19:22:16.948846+00:0050 | throw new HttpError( 2026-05-31 19:22:16.948859+00:00^ 2026-05-31 19:22:16.948871+00:00HttpError: HTTP 405: Method Not Allowed 2026-05-31 19:22:16.948883+00:00status: 405, 2026-05-31 19:22:16.948895+00:00statusText: "Method Not Allowed", 2026-05-31 19:22:16.948907+00:00response: "", 2026-05-31 19:22:16.948920+00:002026-05-31T19:22:16.948920222Z 2026-05-31 19:22:16.948932+00:00at httpRequest (/app/dist/server/chunks/utils_DEEuWbId.mjs:50:13) 2026-05-31 19:22:16.948978+00:002026-05-31T19:22:16.948978174Z 2026-05-31 19:22:17.018803+00:00Publishing event to channel mirror-status:h9p6LkWT68BSX4eQ1Q84EeceAOytYnSi for user h9p6LkWT68BSX4eQ1Q84EeceAOytYnSi 2026-05-31 19:22:17.044937+00:00Event published successfully with ID 078dfc40-cedb-49da-ac45-41ba53f5e784 2026-05-31 19:22:17.046881+00:00=== ITEM PROCESSING FAILED (MAX RETRIES EXCEEDED) === 2026-05-31 19:22:17.046977+00:00Item: unknown 2026-05-31 19:22:17.047008+00:00Error type: Error 2026-05-31 19:22:17.047033+00:00Error message: Failed to sync repository: HTTP 405: Method Not Allowed 2026-05-31 19:22:17.047058+00:00Attempts made: 3 2026-05-31 19:22:17.046975+00:00Retry progress: 100% (1/1) 2026-05-31 19:22:17.047157+00:00All repository retry tasks completed 2026-05-31 19:22:17.047093+00:00Stack trace: Error: Failed to sync repository: HTTP 405: Method Not Allowed 2026-05-31 19:22:17.047210+00:00at <anonymous> (/app/dist/server/chunks/gitea_BIHki0HJ.mjs:1384:17) 2026-05-31 19:22:17.047234+00:00at processTicksAndRejections (native:7:39) 2026-05-31 19:22:17.047255+00:00================================================ 2026-05-31 19:22:17.047275+00:00=== BATCH ITEM PROCESSING ERROR === 2026-05-31 19:22:17.047296+00:00Batch index: 0 2026-05-31 19:22:17.047316+00:00Item index in batch: 0 2026-05-31 19:22:17.047336+00:00Global item index: 0 2026-05-31 19:22:17.047356+00:00Error type: Error 2026-05-31 19:22:17.047375+00:00Error message: Failed to sync repository: HTTP 405: Method Not Allowed 2026-05-31 19:22:17.047396+00:00================================== ``` These are the permissions of my gitea token: <img width="1186" height="278" alt="Image" src="https://github.com/user-attachments/assets/517bf5c5-872e-4d0e-9b82-c87526ba72e0" />
Author
Owner

@arunavo4 commented on GitHub (Jun 2, 2026):

@Vrend please share your config screenshot minus any visible creds or if you use env vars please share minus anything related to creds

<!-- gh-comment-id:4598456739 --> @arunavo4 commented on GitHub (Jun 2, 2026): @Vrend please share your config screenshot minus any visible creds or if you use env vars please share minus anything related to creds
Author
Owner

@Vrend commented on GitHub (Jun 4, 2026):

I think I configured everything through my docker compose, if I remember correctly.

Here is my docker config:

services:
  gitea-mirror:
    container_name: gitea-mirror
    environment:
      - >-
        BETTER_AUTH_SECRET=SECRET
      - BETTER_AUTH_URL=https://gitea-mirror.mydomain.com
      - BETTER_AUTH_TRUSTED_ORIGINS=https://gitea-mirror.mydomain.com
      - NODE_ENV=production
      - DATABASE_URL=file:data/gitea-mirror.db
      - HOST=0.0.0.0
      - PORT=39623
      - BASE_URL=/
      - PUBLIC_BETTER_AUTH_URL=https://gitea-mirror.mydomain.com
      - MIRROR_ISSUE_CONCURRENCY=1
      - MIRROR_PULL_REQUEST_CONCURRENCY=1
    healthcheck:
      interval: 30s
      retries: 5
      start_period: 15s
      test:
        - CMD-SHELL
        - >-
          BASE="${BASE_URL:-/}"; if [ "$${BASE}" = "/" ]; then BASE=""; else
          BASE="$${BASE%/}"; fi; wget --no-verbose --tries=3 --spider
          "http://localhost:39623$${BASE}/api/health"
      timeout: 10s
    image: ghcr.io/raylabshq/gitea-mirror:latest
    ports:
      - '39623:39623'
    restart: unless-stopped
    user: ${PUID:-568}:${PGID:-568}
    volumes:
      - /mnt/.ix-apps/app_configs/gitea-mirror/data:/app/data
<!-- gh-comment-id:4618517016 --> @Vrend commented on GitHub (Jun 4, 2026): I think I configured everything through my docker compose, if I remember correctly. Here is my docker config: ``` services: gitea-mirror: container_name: gitea-mirror environment: - >- BETTER_AUTH_SECRET=SECRET - BETTER_AUTH_URL=https://gitea-mirror.mydomain.com - BETTER_AUTH_TRUSTED_ORIGINS=https://gitea-mirror.mydomain.com - NODE_ENV=production - DATABASE_URL=file:data/gitea-mirror.db - HOST=0.0.0.0 - PORT=39623 - BASE_URL=/ - PUBLIC_BETTER_AUTH_URL=https://gitea-mirror.mydomain.com - MIRROR_ISSUE_CONCURRENCY=1 - MIRROR_PULL_REQUEST_CONCURRENCY=1 healthcheck: interval: 30s retries: 5 start_period: 15s test: - CMD-SHELL - >- BASE="${BASE_URL:-/}"; if [ "$${BASE}" = "/" ]; then BASE=""; else BASE="$${BASE%/}"; fi; wget --no-verbose --tries=3 --spider "http://localhost:39623$${BASE}/api/health" timeout: 10s image: ghcr.io/raylabshq/gitea-mirror:latest ports: - '39623:39623' restart: unless-stopped user: ${PUID:-568}:${PGID:-568} volumes: - /mnt/.ix-apps/app_configs/gitea-mirror/data:/app/data ```
Author
Owner

@arunavo4 commented on GitHub (Jun 14, 2026):

The 405 comes from the mirror-sync call, which Gitea only allows on repos that are actually pull mirrors. That repo isn't registered as a mirror in Gitea (it can lose that state, for example after repeated failed fetches). Check it in Gitea under Settings: if there's no Mirror Settings section, delete the repo there and re-mirror it from gitea-mirror so it gets recreated as a proper pull mirror. v3.18.0 (#319) now surfaces this with a clear message instead of a raw 405.

<!-- gh-comment-id:4700704631 --> @arunavo4 commented on GitHub (Jun 14, 2026): The 405 comes from the `mirror-sync` call, which Gitea only allows on repos that are actually pull mirrors. That repo isn't registered as a mirror in Gitea (it can lose that state, for example after repeated failed fetches). Check it in Gitea under Settings: if there's no Mirror Settings section, delete the repo there and re-mirror it from gitea-mirror so it gets recreated as a proper pull mirror. v3.18.0 (#319) now surfaces this with a clear message instead of a raw 405.
Author
Owner

@Vrend commented on GitHub (Jun 16, 2026):

Updating, deleting on gitea, and deleting in this app fixed the issue.

Weirdly, it was marked as a pull mirror in gitea, at least based on the gitea UI.

<!-- gh-comment-id:4719875829 --> @Vrend commented on GitHub (Jun 16, 2026): Updating, deleting on gitea, and deleting in this app fixed the issue. Weirdly, it was marked as a pull mirror in gitea, at least based on the gitea UI.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea-mirror#5812