chore: rename project to github-to-gitea-mirror

The old name left the mirror direction open — it could just as well be read
as Gitea being the source. Naming source and target in that order removes the
ambiguity for anyone setting this up, and matches the title the README already
carried.

The name is not just internal: it is the install directory and the identifier
both APIs record in their request logs, so an inconsistent name would stay
visible in places that are awkward to correct after the fact.

Existing installations are not migrated. The old directory and its cron entry
survive an installer re-run and would sync a second time in parallel, so they
need to be removed by hand.
This commit is contained in:
Andre
2026-08-08 11:19:20 +02:00
parent ecc8aa1c1a
commit 6ff4da99e4
4 changed files with 16 additions and 16 deletions
+10 -10
View File
@@ -32,12 +32,12 @@ with 1 GB RAM the sync is invisible in `free -h`.
### Installation
```bash
git clone <this-repo> gitea-github-mirror
cd gitea-github-mirror
git clone <this-repo> github-to-gitea-mirror
cd github-to-gitea-mirror
./install.sh
```
`install.sh` copies the scripts to `~/gitea-github-mirror`, creates `mirror.env`
`install.sh` copies the scripts to `~/github-to-gitea-mirror`, creates `mirror.env`
from the example, fixes permissions and adds the cron entry. It is safe to
re-run — an existing `mirror.env` is never overwritten.
@@ -57,7 +57,7 @@ docker exec -u git <container> gitea admin user generate-access-token \
Then fill in `mirror.env` and verify:
```bash
cd ~/gitea-github-mirror
cd ~/github-to-gitea-mirror
DRY_RUN=true python3 sync_mirrors.py # preview, changes nothing
python3 sync_mirrors.py # run for real
```
@@ -150,7 +150,7 @@ python3 -m unittest discover -s tests -v
### Troubleshooting
```bash
tail -f ~/gitea-github-mirror/sync.log
tail -f ~/github-to-gitea-mirror/sync.log
```
| Log line | Cause |
@@ -209,12 +209,12 @@ Raspberry Pi 3B mit 1 GB RAM ist der Sync in `free -h` nicht zu sehen.
### Installation
```bash
git clone <dieses-repo> gitea-github-mirror
cd gitea-github-mirror
git clone <dieses-repo> github-to-gitea-mirror
cd github-to-gitea-mirror
./install.sh
```
`install.sh` kopiert die Skripte nach `~/gitea-github-mirror`, legt `mirror.env`
`install.sh` kopiert die Skripte nach `~/github-to-gitea-mirror`, legt `mirror.env`
aus der Vorlage an, setzt die Rechte und trägt den Cron-Job ein. Mehrfaches
Ausführen ist unbedenklich — eine vorhandene `mirror.env` wird nie überschrieben.
@@ -234,7 +234,7 @@ docker exec -u git <container> gitea admin user generate-access-token \
Danach `mirror.env` ausfüllen und prüfen:
```bash
cd ~/gitea-github-mirror
cd ~/github-to-gitea-mirror
DRY_RUN=true python3 sync_mirrors.py # Vorschau, ändert nichts
python3 sync_mirrors.py # echter Lauf
```
@@ -333,7 +333,7 @@ python3 -m unittest discover -s tests -v
### Fehlersuche
```bash
tail -f ~/gitea-github-mirror/sync.log
tail -f ~/github-to-gitea-mirror/sync.log
```
| Log-Zeile | Ursache |
+1 -1
View File
@@ -9,7 +9,7 @@
set -eu
SRC="$(dirname "$(readlink -f "$0")")"
TARGET="${TARGET:-$HOME/gitea-github-mirror}"
TARGET="${TARGET:-$HOME/github-to-gitea-mirror}"
CRON_TIME="${CRON_TIME:-30 4}"
say() { printf '%s\n' "$*"; }
+4 -4
View File
@@ -95,7 +95,7 @@ def api(url, token=None, scheme="token", method="GET", payload=None):
data = None
headers = {
"Accept": "application/json",
"User-Agent": "gitea-github-mirror/1.0",
"User-Agent": "github-to-gitea-mirror/1.0",
}
if payload is not None:
data = json.dumps(payload).encode("utf-8")
@@ -137,7 +137,7 @@ def download_github_asset(cfg, asset):
"""Download a release asset into a temporary file without buffering it in RAM."""
headers = {
"Accept": "application/octet-stream",
"User-Agent": "gitea-github-mirror/1.0",
"User-Agent": "github-to-gitea-mirror/1.0",
}
if cfg["GITHUB_TOKEN"]:
headers["Authorization"] = "Bearer %s" % cfg["GITHUB_TOKEN"]
@@ -169,7 +169,7 @@ def upload_release_asset(cfg, repo_name, release_id, asset, source, size):
% (cfg["GITEA_URL"], path_part(cfg["GITEA_OWNER"]), path_part(repo_name),
release_id, query))
parsed = urllib.parse.urlsplit(url)
boundary = "----gitea-github-mirror-%s" % uuid.uuid4().hex
boundary = "----github-to-gitea-mirror-%s" % uuid.uuid4().hex
safe_name = str(asset["name"]).replace("\\", "_").replace('"', "_")
safe_name = safe_name.replace("\r", "_").replace("\n", "_")
content_type = asset.get("content_type") or "application/octet-stream"
@@ -195,7 +195,7 @@ def upload_release_asset(cfg, repo_name, release_id, asset, source, size):
conn.putheader("Accept", "application/json")
conn.putheader("Content-Type", "multipart/form-data; boundary=%s" % boundary)
conn.putheader("Content-Length", str(len(preamble) + size + len(ending)))
conn.putheader("User-Agent", "gitea-github-mirror/1.0")
conn.putheader("User-Agent", "github-to-gitea-mirror/1.0")
conn.endheaders()
conn.send(preamble)
while True:
+1 -1
View File
@@ -1 +1 @@
"""Tests for gitea-github-mirror."""
"""Tests for github-to-gitea-mirror."""