gshr
git static host repo -- generates static html for repos
git clone https://git.vogt.world/gshr.git
Log | Files | README.md | LICENSE
← All files
name: README.md
-rw-r--r--
4850
  1# gshr
  2
  3> Git static host repo.
  4
  5Command line tool for generating stand-alone, static git html hosting. Produces a single output
  6directory for multiple repos, with...
  7
  8* Root index.html that lists all input repos.
  9* Commit log page for each repo.
 10* Individual commit page summarizing commit including diff.
 11* File list page for each repo for the current HEAD ref.
 12* File detail/preview page for each file in current HEAD ref.
 13* Statically clone-able git dir for each repo.
 14
 15---
 16
 17See for yourself.
 18
 19```bash
 20git clone https://github.com/vogtb/gshr
 21cd gshr
 22make dev-example-gshr-simple
 23```
 24
 25Which basically runs this.
 26
 27```bash
 28./target/gshr.bin -c=example-config-gshr-simple.toml -o=target/output
 29cd target/output
 30python3 -m http.server 80
 31```
 32
 33See example TOML configs in root directory.
 34
 35---
 36
 37## Usage
 38
 39```
 40Usage of gshr:
 41  -c Config file.
 42  -o Dir of output.
 43  -s Run in silent mode.
 44```
 45
 46The toml file needs to be in the format:
 47
 48* `site`: Site-level configuration.
 49  * `base_url`: Base url for the site. Eg: `"/"` or `"https://mysite.com/code/"`.
 50  * `name`: Site name displayed on the main index.html page that lists all repos.
 51* `repos` List of data for each repo.
 52  * `name`: Name of repo to be used in display, paths.
 53  * `description`: Description of repo used in html pages.
 54  * `url`: Absolute, relative, or remote. eg: `/home/repo`, `./repo`, `git://`, `http://`.
 55  * `alt_link`: Optional Link to where the repo lives. Eg: `github.com/vogtb/gshr`.
 56
 57Example:
 58
 59```toml
 60[site]
 61base_url = "http://localhost/"
 62name = "development site - should run on port 80"
 63
 64[[repos]]
 65name = "gshr"
 66description = "git static host repo -- generates static html for repos"
 67url = "https://github.com/vogtb/gshr"
 68alt_link = "https://github.com/vogtb/gshr"
 69```
 70
 71---
 72
 73## Output
 74
 75```text
 76{output_dir}/
 77  index.html
 78  {repo_name}/
 79    log.html
 80    commits/
 81      {hash}/commit.html
 82    files.html
 83    files/
 84      {full_file_name}/file.html
 85  {repo_name}.git
 86      {...raw git file data}
 87```
 88
 89Example:
 90
 91```text
 92output
 93├── favicon.ico
 94├── gshr
 95│   ├── commit
 96│   │   ├── 069606b3fcd2f96fc4349943326fb31f9d3c561f
 97│   │   │   └── index.html
 98│   │   │   ...
 99│   │   │   ...
100│   │   └── fe47541cb62d6f513734089afda72ddefe672924
101│   │       └── index.html
102│   ├── files
103│   │   ├── LICENSE
104│   │   │   └── index.html
105│   │   ├── Makefile
106│   │   │   └── index.html
107│   │   ├── README.md
108│   │   │   └── index.html
109│   │   │   ...
110│   │   │   ...
111│   │   ├── main.go
112│   │   │   └── index.html
113│   │   └── templates
114│   │       ├── commit.html
115│   │       │   └── index.html
116│   │       │   ...
117│   │       │   ...
118│   │       └── partials.html
119│   │           └── index.html
120│   ├── files.html
121│   └── log.html
122├── gshr.css
123├── gshr.git
124│   ├── HEAD
125│   ├── config
126│   ├── index
127│   ├── info
128│   │   └── refs
129│   ├── objects
130│   │   ├── info
131│   │   │   └── packs
132│   │   └── pack
133│   │       ├── pack-a6e75f15316a2d809290159b8bdc88303c8090cb.idx
134│   │       └── pack-a6e75f15316a2d809290159b8bdc88303c8090cb.pack
135│   └── refs
136│       ├── heads
137│       │   └── main
138│       ├── remotes
139│       │   └── origin
140│       │       └── main
141│       └── tags
142└── index.html
143```
144
145---
146
147# License
148
149The MIT License (MIT)
150
151Copyright (c) 2023 Ben Vogt
152
153Permission is hereby granted, free of charge, to any person obtaining a copy
154of this software and associated documentation files (the "Software"), to deal
155in the Software without restriction, including without limitation the rights
156to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
157copies of the Software, and to permit persons to whom the Software is
158furnished to do so, subject to the following conditions:
159
160The above copyright notice and this permission notice shall be included in all
161copies or substantial portions of the Software.
162
163THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
164IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
165FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
166AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
167LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
168OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
169SOFTWARE.