Org-wide GitHub push whitelist & local-forge → GitHub mirror hooks for AwesomeOs — keeping experimental/private branches strictly local while mirroring only approved repositories to GitHub with text-only LFS pointers.
(Paired with awesome-os/github-runner. Named github-hooks intentionally so private/internal git-hooks remain cleanly separated.)
flowchart LR
WT["Worktrees<br/>E:\awesome-os.worktrees\*"] -->|"git push local-forge"| FORGE["Sovereign Local Forge<br/>E:\awesome-os.git"]
FORGE -->|"binary blobs"| LFS["Local LFS Store<br/>E:\awesome-os.lfs"]
FORGE -->|"hooks/post-receive<br/>(forge-mirror.conf whitelist)"| GATE{"Whitelisted<br/>ref?"}
GATE -->|"Yes (GIT_LFS_SKIP_PUSH=1)"| GH["GitHub Public Repos<br/>(commits + text LFS pointers only)"]
GATE -->|"No (experimental / private)"| LOCAL["Stays 100% Local<br/>in E:\awesome-os.git"]
| File | Role |
|---|---|
forge-mirror.conf |
Single source of truth for allowed GitHub mirrors (<local-forge-ref> <github-url> <github-target-ref>). |
hooks/post-receive |
Server-side bare forge hook: triggered on every push to E:\awesome-os.git. Mirrors only refs listed in forge-mirror.conf to GitHub with GIT_LFS_SKIP_PUSH=1, blocks auto-deletion of remote branches, and keeps all unlisted branches private. |
hooks/pre-push |
Client & github-runner guard: intercepts direct git push to any github.com remote and rejects any ref not whitelisted in forge-mirror.conf. Pushes to local-forge are always allowed. |
install-hooks.ps1 |
Windows PowerShell installer for both bare local forges (-Forge) and client/runner core.hooksPath (-Global or repo-local). |
install-hooks.sh |
POSIX /bin/sh installer for Linux, macOS, and awesome-os/github-runner containers. |
# From E:\awesome-os.worktrees\github-hooks
.\install-hooks.ps1 -Forge E:\awesome-os.git# Linux / macOS bare forge
./install-hooks.sh --forge /srv/awesome-os.gitThen configure each worktree/repo to push to local-forge:
git remote add local-forge E:\awesome-os.git
git config remote.local-forge.push refs/heads/main:refs/heads/repositorys/main
git push local-forgeWhat happens on git push local-forge:
E:\awesome-os.gitreceives your commit and auto-updates its checked-out worktree (receive.denyCurrentBranch=updateInstead).- Any binary assets tracked by Git LFS stay in
E:\awesome-os.lfs. hooks/post-receivechecksforge-mirror.conf:- Matched: pushes
${newrev}:${target_ref}to GitHub withGIT_LFS_SKIP_PUSH=1(text LFS pointers only). - Not matched: prints
local-only (not in forge-mirror.conf) — kept private in local forgeand never touches GitHub.
- Matched: pushes
Prevents accidental direct pushes of experimental/scratch branches to github.com:
# Repo-local
.\install-hooks.ps1
# Machine-wide (all repos)
.\install-hooks.ps1 -Global./install-hooks.sh --globalawesome-os/github-runner natively supports awesome-os/github-hooks via --install-hooks and logs [github-hooks] ACTIVE at runner startup:
node runner-core.mts --install-hooksYou can also point any runner container at a custom checkout via AWESOME_GITHUB_HOOKS_DIR=/path/to/github-hooks/hooks.
# <local-forge-ref> <github-remote-url> <github-target-ref>
refs/heads/repositorys/main https://github.com/awesome-os/repositorys.git refs/heads/main
refs/heads/org/github-hooks https://github.com/awesome-os/github-hooks.git refs/heads/main
refs/heads/org/github-runner https://github.com/awesome-os/github-runner.git refs/heads/main
refs/heads/org/win-omarchy https://github.com/awesome-os/win-omarchy.git refs/heads/main- Blank lines and
#comments are ignored. - Branch deletions (
0000000000000000000000000000000000000000) are never forwarded to GitHub. - If GitHub is unreachable (offline work),
post-receivelogs a warning and exits0so your local push is never blocked.
| Variable | Default | Effect |
|---|---|---|
GIT_FORGE_NO_GITHUB |
0 |
Set to 1 to skip GitHub mirroring during offline or batch pushes to local-forge. |
GIT_FORGE_MIRROR_CONF |
auto-detected | Explicit path to forge-mirror.conf (overrides $GIT_DIR/forge-mirror.conf and ../forge-mirror.conf). |
GIT_GITHUB_HOOKS_ALLOW |
0 |
Set to 1 as an explicit one-shot override for hooks/pre-push. |
AWESOME_GITHUB_HOOKS_DIR |
auto-detected | Used by awesome-os/github-runner to locate the hooks/ directory. |
SPDX-License-Identifier: BSD-3-Clause