- Go 73%
- CSS 22%
- Makefile 2%
- Shell 2%
- Nix 1%
- 1 more language <1%
pgit #
A static site generator for git forked from pgit.
Features:
- Generates a limited number of commits and revisions to minimize bot traffic load
- Includes an index generator as an entry point for multiple repositories
- Integrates with git-bug for issue tracking
- A bit different design sensibility than the original pgit
Things it doesn't do:
- No native solution for PRs or external contributions to issues (I just use email for that)
Usage #
building with make #
make build
./pgit --revs main --label pgit --out ./public
building with nix flakes #
Build the project:
nix build
This creates a result symlink containing the pgit binary at result/bin/pgit.
Run the binary:
./result/bin/pgit --revs main --label pico --out ./public
To learn more about the options run:
./pgit --help
Themes #
We support all chroma themes, but github-dark is the most tested.
With multiple repos #
--root-relative sets the prefix for all links (default: /). This makes it so
you can run multiple repos and have them all live inside the same static site.
pgit \
--out ./public/pico \
--home-url "https://git.erock.io" \
--revs main \
--repo ~/pico \
--root-relative "/pico/"
pgit \
--out ./public/starfx \
--home-url "https://git.erock.io" \
--revs main \
--repo ~/starfx \
--root-relative "/starfx/"
echo '<html><body><a href="/pico">pico</a><a href="/starfx">starfx</a></body></html>' > ./public/index.html
rsync -rv ./public/ <your server>:/git
Commit Limiting #
By default, pgit limits the number of commits rendered to 30. This helps reduce server load from crawlers and encourages users to clone the repository for full history.
Without any flags, pgit will render the 30 most recent commits:
./pgit --revs main --out ./public
The commit log page will display a message like:
"An additional 45 commits exist. Clone the repo to review them."
Showing all commits #
To render the complete commit history, use --limit=-1:
./pgit --revs main --out ./public --limit=-1
Custom limits #
You can specify any number of commits to render:
# Show only the 10 most recent commits
./pgit --revs main --out ./public --limit=10
Post-commit hook #
pgit includes a post-commit hook that automatically closes git-bug issues when you reference them in commit messages.
Installation #
Install the hook in your repository:
./pgit install-hook --repo=/path/to/your/repo
Usage #
Once installed, the hook will automatically:
- Parse your commit messages for issue references
- Add a comment "Fixed in commit [hash]" to the referenced issue
- Close the git-bug issue
Supported keywords (case-insensitive):
fix,fixes,fixedclose,closes,closedresolve,resolves,resolved
Example commit messages:
git commit -m "fixes #872a52d - resolved the memory leak"
git commit -m "This commit closes #abc1234 and resolves #def5678"
Uninstallation #
Remove the hook:
./pgit uninstall-hook --repo=/path/to/your/repo
This will restore any previous post-commit hook if one existed.
Special Thanks #
This project was heavily inspired by stagit and is a fork of pgit.
License #
The pgit project was originally licensed under MIT. This version is relicensed GPL because of the git-bug integration.