A tiny git forge written in Go

Related tags

Command Line smithy
Overview

Smithy

smithy (n) A blacksmith's shop; a forge.

Smithy is a web frontend for git repositories. It's implemented entirely in Golang, compiles to a single binary, and it's fast and easy to deploy. Smithy is an alternative to cgit or gitweb, and doesn't seek to compete with Gitea and the like.

  • Golang
  • Single binary
  • Easy to deploy
  • Fast
  • Customizable
  • Free software
  • Javascript-free

Building

The only dependency is Golang 1.15 or higher. Contributors to smithy should have the optional scdoc for generating documentation.

$ git clone https://github.com/honza/smithy
$ make
$ ./smithy --help

Installing

We provide a make rule for installing/uninstall smithy. It will also install a sample configuration file at /usr/local/share/smithy/smithy.yml that you can later use as a guide.

$ make install
$ make uninstall

Configuration

You can generate a sample configuration by issuing make smithy.yml command or directly using the smithy binary:

$ make smithy.yml # will generate a smithy.yml file
$ smithy generate > config.yml
$ smithy serve --config config.yml

A sample configuration can be:

title: Smithy, a lightweight git forge
description: Publish your git repositories with ease
port: 3456
git:
  root: "/var/www/git"
  repos:
    - path: "some-cool-project"
      slug: "some-cool-project"
      title: "Some Cool Project"
      description: "Something really cool to change the world"
    - path: "ugly-hacks"
      exclude: true

static:
  root:
  prefix: /static/

templates:
  dir:

Customizing templates and css

Out of the box, smithy bundles templates and css in the binary. Setting static.root, and templates.dir to empty string will cause smithy to use the bundled assets.

If you'd like to customize the templates or the css, copy the include directory somewhere, and then set static.root, and templates.dir to that directory.

Demo

Smithy is currently hosting itself on my domain.

Contributing

Contributions are most welcome. You can open a pull request on GitHub, or email a patch to [email protected].

TODO

  • Add support for go modules
  • Add routes for commits ending in .patch

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.

Comments
  • Patch support

    Patch support

    While I was writing support for .patch, I've stumbled upon go-git not having support for patches.

    I opened an issue, to either add better support for patches or writing format-patch on go-git. We still can write that manually on smithy, but I would rather wait, what do you think?

    opened by pedrolucasp 4
  • template cleanup

    template cleanup

    • fix closing tag in tree template
    • remove redundant repo name in commit template
    • always call repository name RepoName
    • use consistent base template context
    • pass context to the header template
    • add dependency for binary on include files
    opened by dhellmann 3
  • cannot build offline cos statik are dependency

    cannot build offline cos statik are dependency

    commit e4b24bd9b86f91e590ca0df270d249039a3503b2 this means golang is not the only dependence, so we need to use also statik from comamnd system to able to produce distribution packages from this great tool!

    opened by mckaygerhard 3
  • make command failing

    make command failing

    Hi,

    when I run the make command I get the following error

    [email protected]:~/Development/GolangDev/smithy$ make
    
    mkdir -p bin
    
    go mod download
    
    go build -o bin/statik /src/github.com/rakyll/statik/statik.go
    
    stat /src/github.com/rakyll/statik/statik.go: directory not found
    
    make: *** [Makefile:12: bin/statik] Error 1
    
    opened by johnzan 3
  • patch view: introduce a view for commits ending in .patch

    patch view: introduce a view for commits ending in .patch

    This new view introduces a text/plain version of a single patch. It has some differences when using git format-patch and will match more the --no-stats version of the refered git command. This is due the fact that go-git has no support for summary for diffs yet (I have a patch waiting for over a month there) 1.

    There's also a problem when dealing with the root commit, which go-git Patch API still doesn't support 2.

    opened by pedrolucasp 2
  • blob view: remove extra prefix in path value

    blob view: remove extra prefix in path value

    Files immediately under the root of the repo were being rendered as ././name because the template includes a static ./ value. Remove that so the path is always accurate.

    opened by dhellmann 1
  • Statik dependency during build

    Statik dependency during build

    You say that the only dependency is Golang in the README. But when I try to compile the project by doing

    $ git clone https://github.com/honza/smithy
    $ make 
    

    I get

    make: statik: No such file or directory
    make: *** [all] Error 
    

    Maybe the documentation should be updated ?

    opened by aureliar8 1
  • Failed to load templates: template: header.html:10: function

    Failed to load templates: template: header.html:10: function "css" not defined

    When using the files directly from include Smithy can't start, because header.html tries to call {{css}} which seems to be not defined, although I can see it here. My knowledge of Go is limited though.

    opened by nkoehring 1
  • tree view: format preamble consistently with blob view

    tree view: format preamble consistently with blob view

    Wrap the ref in paragraph tags so the vertical alignment is consistent with the content in the blob.html template, so that when the user clicks through from a directory listing to an individual file the header section of the page does not appear to change sizes.

    Remove the extra path value, since it is the same as the parent path.

    opened by dhellmann 0
  • include static prefix in default config

    include static prefix in default config

    The default configuration generated by smithy generate did not include the static.prefix value, which is needed to make the templates render. This commit adds a default value based on the setting in the README.

    opened by dhellmann 0
  • Basic Service File

    Basic Service File

    Hi, what would a basic service file fo smithy look like?

    For example, with runit could it just be to start the server on boot?

    #!/bin/sh
    
    exec smithy serve --config config.yml 2>&1
    

    I guess the service would also need to restart when a git repository is pushed to or should that be handled by a git hook instead?

    What would be the ideal set up?

    opened by jgarte 2
  • Tarball support

    Tarball support

    A cool feature would be support downloading tarballs from refs, specially for tags and commits.

    This probably would involve firing up git-archive (1) if go-git doesn't have support for this already.

    opened by pedrolucasp 2
  • Add support for grouping repositories

    Add support for grouping repositories

    Today we have a bug where if a repository is under a directory, we don't load it correctly. As I wrote a patch to fix this, I started to wonder if adding support for grouping repositories would not make more sense. I think this should be discussed if we should infer if the repository path has a slash, we should group it (cgit does this), or if we should add first class support to the project group, with its title, description, etc. It would also make more sense considering that smithy shows "Projects", and some are often made up of several different repositories.

    opened by pedrolucasp 0
Owner
Honza Pokorny
Honza Pokorny
A CLI to replace your git commit command, so your git message can partially follow the Conventional Changelog ecosystem

COMMIT CLI A CLI to replace your git commit command, so your git message can partially follow the Conventional Changelog ecosystem. And yes, it is bui

Hisam Fahri 1 Feb 9, 2022
git-glimpse is a command-line tool that is aimed at generating a git prompt like the one from zsh-vcs-prompt.

Git GoGlimpse git-glimpse is a command-line tool that is aimed at generating a git prompt like the one from zsh-vcs-prompt. The particularity of this

Corentin de Boisset 0 Jan 27, 2022
Modern ls command with vscode like File Icon and Git Integrations. Written in Golang

logo-ls modern ls command with beautiful Icons and Git Integrations . Written in Golang Command and Arguments supported are listed in HELP.md Table of

Yash Handa 936 Nov 23, 2022
A tiny "sandbox" to run untrusted code 🏖️

Sandy A tiny sandbox to run untrusted code. ??️ Sandy uses Ptrace to hook into READ syscalls, giving you the option to accept or deny syscalls before

Craig Mulligan 338 Nov 14, 2022
A tiny markup language for terminal output. Makes formatting output in CLI apps easier!

tml - Terminal Markup Language A Go module (and standalone binary) to make the output of coloured/formatted text in the terminal easier and more reada

Liam Galvin 701 Nov 11, 2022
A tiny Nano wallet, focused on ease of use through simplicity

atto is a tiny Nano wallet, which focuses on ease of use through simplicity. Disclaimer: I am no cryptographer and atto has not been audited. I cannot

Richard Ulmer 35 Nov 14, 2022
A tiny Go library + client for downloading Youtube videos. The library is capable of fetching Youtube video metadata, in addition to downloading videos.

A tiny Go library + client (command line Youtube video downloader) for downloading Youtube videos. The library is capable of fetching Youtube video metadata, in addition to downloading videos. If ffmpeg is available, client can extract MP3 audio from downloaded video files.

Kunal Diwan 3 Oct 14, 2022
A tiny cli command/daemon for syncing toggl time entries with Jira

toggl-sync A tiny cli command/daemon for syncing toggl time entries with Jira Installation Install the app via brew package manager. brew tap timemate

TimeMate 2 Nov 30, 2021
Tiny binary serializer and deserializer to create on demand parsers and compilers

Parco Hobbyist binary compiler and parser built with as less reflection as possible, highly extensible and with zero dependencies. There are plenty pa

Marquitos 57 Nov 9, 2022
You-Get is a tiny command-line utility to download media contents (videos, audios, images) from the Web,

You-Get NOTICE: Read this if you are looking for the conventional "Issues" tab. You-Get is a tiny command-line utility to download media contents (vid

Mort Yao 46k Nov 20, 2022
A tiny command-line orientated PKM tool inspired by Taskwarrior and daily logging.

eden eden is a command line tool for creating and manipulating daily log notes. It started life as a series of different bash script that did various

null 0 Jan 20, 2022
minigli is a tiny command argument parser for Go.

minigli is a tiny command argument parser for Go.

hitoshi44 0 Jan 29, 2022
Simple, seamless, lightweight time tracking for Git

Git Time Metric Seamless time tracking for all your Git projects $ gtm report -last-month $ gtm report -last-month -format summary $ gtm report -last-

Git Time Metric 916 Nov 21, 2022
commit/branch/workdir explorer for git

gitin gitin is a commit/branch/status explorer for git gitin is a minimalist tool that lets you explore a git repository from the command line. You ca

Ibrahim Serdar Acikgoz 1.8k Nov 23, 2022
💊 A git query language

Gitql Gitql is a Git query language. In a repository path... See more here Reading the code ⚠️ This project was created in 2014 as my first go project

Claudson Oliveira 6k Nov 13, 2022
git-xargs is a command-line tool (CLI) for making updates across multiple Github repositories with a single command.

Table of contents Introduction Reference Contributing Introduction Overview git-xargs is a command-line tool (CLI) for making updates across multiple

Gruntwork 685 Nov 21, 2022
A better way to clone, organize and manage multiple git repositories

git-get git-get is a better way to clone, organize and manage multiple git repositories. git-get Description Installation macOS Linux Windows Usage gi

Greg Dlugoszewski 64 Nov 16, 2022
Bit is a modern Git CLI

bit is an experimental modernized git CLI built on top of git that provides happy defaults and other niceties: command and flag suggestions to help yo

Chris Walz 5.9k Nov 27, 2022
Interactive CLI helper for creating git branches with JIRA Links and some text

bb (better-branch) Interactive CLI helper for creating git branches with JIRA Links and some text Still in development? Yes How it works? This tiny ut

Eugene Uvarov 3 Aug 18, 2022