85 lines
2.6 KiB
Markdown
85 lines
2.6 KiB
Markdown
# Gitocean
|
|
|
|
Gitocean is a small Go-based Git hosting platform for personal use. It provides a CLI, minimal server-rendered web UI, JSON HTTP API, MySQL metadata storage, and HTTP Smart Git transport. There is no SSH transport.
|
|
|
|
## Quickstart
|
|
|
|
```bash
|
|
go run ./cmd/gitocean init
|
|
go run ./cmd/gitocean server --config storage/config.json
|
|
```
|
|
|
|
In another shell:
|
|
|
|
```bash
|
|
go run ./cmd/gitocean register
|
|
go run ./cmd/gitocean login
|
|
go run ./cmd/gitocean repo create demo --public
|
|
go run ./cmd/gitocean clone USER/demo
|
|
```
|
|
|
|
Open the minimal web UI at the server URL, for example:
|
|
|
|
```text
|
|
http://localhost:8080/repos
|
|
```
|
|
|
|
Web UI routes include `/repos`, `/login`, `/register`, `/repos/new`, `/{username}`, `/{username}/{repo}`, `/{username}/{repo}/branches`, `/{username}/{repo}/commits`, `/{username}/{repo}/commit`, and pull request pages.
|
|
|
|
## Storage
|
|
|
|
Bare repositories are stored under:
|
|
|
|
```text
|
|
storage/repos/{owner}/{repo}.git
|
|
```
|
|
|
|
Server config defaults to:
|
|
|
|
```text
|
|
storage/config.json
|
|
```
|
|
|
|
CLI auth config defaults to:
|
|
|
|
```text
|
|
~/.config/gitocean/config.json
|
|
```
|
|
|
|
## Web UI
|
|
|
|
The web UI is intentionally minimal and server-rendered. It supports repository search, user profile pages with public repositories, login/register/logout, repository creation, branch selection, a branches page for branch creation/deletion, selected-branch latest commit and commit count status, commit history pages, single commit pages with limited diff rendering, repository file browsing, Markdown rendering, image rendering for common image files, plain-text file viewing, simple textarea-based file editing with commit messages for users with write access, pull request list/create/view/comment/close/merge workflows, and forking public repositories. Private repositories cannot be forked. Branch renaming is intentionally unsupported in both the API and web UI.
|
|
|
|
## Development
|
|
|
|
Run checks with:
|
|
|
|
```bash
|
|
gofmt -w .
|
|
go test ./...
|
|
go vet ./...
|
|
go test -cover ./...
|
|
```
|
|
|
|
Optional integration tests:
|
|
|
|
```bash
|
|
go test -tags=integration ./...
|
|
GITOOCEAN_TEST_MYSQL_DSN='user:pass@tcp(127.0.0.1:3306)/gitocean_test?parseTime=true' go test -tags=integration ./...
|
|
```
|
|
|
|
## Code layout
|
|
|
|
```text
|
|
cmd/gitocean/ thin executable entrypoint
|
|
internal/app/ application command dispatch and domain handlers
|
|
internal/model/ shared data models
|
|
internal/config/ client/server config helpers
|
|
internal/dbutil/ MySQL connection helpers
|
|
internal/gitutil/ reusable Git command helpers
|
|
internal/httputil/ JSON HTTP helpers
|
|
internal/backup/ backup/restore helpers
|
|
internal/validate/ name and branch validators
|
|
plans/ phase plans
|
|
```
|