A quick & dirty git-powered Sinatra wiki
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 104 commits ahead, 3 commits behind sr:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



git-wiki is a wiki that relies on git to keep pages' history and Sinatra to serve them. This geek brain overlay system aims to replace trac (wiki and ticket system), a CMS and sticky notes.

Features of this fork (by geekQ)

Support for images and attachments

You can add images to /img folder of your git repository. Subfolders are also supported. At least gif, png and jpg supported - content type is set automatically by Sinatra. You can reference the images then from your wiki pages like ![My picture](/img/2009/my_picture.jpg)

No web interface at this time - use git commit.

Similarly you can use attachments by putting them into the documents folder. Link like [Download my document](/documents/my_doc.doc)

Custom h1 header

If your wiki page contains a markdown h1 header, then this one is used on the page. If not, then h1 is created out of the file name (as in original git-wiki).


Content separated by headers like h1 is wrapped with divs, so you can style such blocks as you wish. Every header gets a unique id based on the header content.


You can provide a custom stylesheet for your wiki or project in the project.css file.

Wiki in a subfolder

You can use git-wiki for documentation of your software project. Simply put all the content in markdown format into a subfolder, e.g. wiki and provide the folder name as optional parameter.

Example run.ru to place in your wiki subfolder:

#!/usr/bin/env rackup
#\ -p 8719
require 'git-wiki' # adjust path to your git-wiki installation if needed
run GitWiki.new(File.dirname(File.dirname(File.expand_path(__FILE__))), ".markdown", "Home", 'wiki')

You can start the web server now with ./run.ru.

Upstream git repository


  • you use a central git server e.g. gitosis or github.com to manage the code for your project
  • you use a subdirectory e.g. wiki as descibed above to store documentation of your project
  • you can run git-wiki locally on a subdirectory (s. above)
  • but you want to integrate changes in your wiki quickly without the need to merge your local wiki changes manually

Solution: use this git-wiki version! Configure a git remote with the name origin. git-wiki automatically recognizes this and pulls and pushes on every topic change if the upstream server is reachable.

Note: even if the central gitosis server and the git-wiki are installed on the same computer, you still need two git repositories. IkiWiki (another git based wiki) has similar requirements ikiwiki repos:

You may find yourself wondering why there are so many git repositories for a single wiki. The setup with a remote "bare" repository allows Ikiwiki to avoid a situation where you might "push" content to a non-bare repository, which would cause the "working copy" of the "source directory" repository to get out of sync with the sequence of commits in the git database. In short, never push to a non-bare git repository.

Integrated TODO list(s)

Just write TODO or DONE at the beginning of a line with task you would like to remember.


You can include tasks from other wiki pages. So it is possible to have one separate page per project, e.g. ProjectGitWiki, ProjectWorkflow and to aggregate all coding tasks on one, say ContextCoding page with INCLUDE project:GitWiki, INCLUDE project:Workflow.

You can also reference other contexts with INCLUDE context:AtHome.

Recursion can be turned on with INCLUDE context:AtHome recursive:true. It is off by default.

You can also reference a source on the web. I prefer to manage my tasks related to git-wiki development in this README file. So on my ContextCoding page I have following reference: INCLUDE http://github.com/geekq/git-wiki/raw/master/README.markdown

  • DONE: include via http
  • DONE: recursive inclusion
  • DONE: mark included tasks in special way
  • DONE: switch recursion on or off
  • DONE: avoid endless recursion by saving a list of visited nodes
  • TODO: include a task list filtered by tagged value, e.g. TASKS context:home should list all the tasks for the specified context.
  • DONE: allow optional asterisk in front of TODO
  • TODO: group included lists by project
  • TODO: merge and resort tasks from subsequent INCLUDE statements
  • DONE: gather all tasks from all pages with INCLUDE wiki:all
  • TODO: gather all the remaining (not referenced) tasks into task inventory page

No wiki words

For a hacker the wiki words is more a distraction than a help. Example: if I mention ActiveRecord, than it should not link to the wiki article ActiveRecord but appear as it is.

  • DONE: do not rely on wiki words

Other plans

  • TODO: show revision hash of the current page
  • TODO: show git repository log -5 (master, origin/master, last changes, time) with ajax. 3 seconds after the page is loaded.
  • TODO: user specified commit message to mark major changes
  • DONE: pull before showing page
  • TODO: make faster by doing push/pull in the background with fork
  • TODO: find pages by prefix - searching for cl should show the existing cloud page, not the edit mode for cl
  • TODO: check dead links
  • TODO: search engine
  • IDEA: presentation system - markdown + my S5 alternative
  • IDEA: support for attachments
  • IDEA: support for deeper Wiki page folder structure
  • IDEA: support for special programmed pages - via haml or liquid template engine


The following gems are required to run git-wiki:

Run with mkdir ~/wiki && (cd ~/wiki && git init) && ./run.ru -sthin -p4567 and point your browser at Enjoy!

See also


[...] the first wiki engine I'd consider worth using for my own projects.

Steve Dekorte

Oh, it looks like Git Wiki may be the starting point for what I need...

Tom Morris on "How to build the perfect wiki"

What makes git-wiki so cool is because it is backed by a git store, you can clone your wiki just like you could any other git repository. I’ve always wanted a wiki that I could a.) pull offline when I didn’t have access to the Internets and b.) edit (perhaps in bulk) in my favorite text editor. git-wiki allows both.

Cloning your wiki

Numerous people have written diff and merge systems for wikis; TWiki even uses RCS. If they used git instead, the repository would be tiny, and you could make a personal copy of the entire wiki to take on the plane with you, then sync your changes back when you're done.

Git is the next Unix

MIT license

Copyright (c) 2009, 2010 Vladimir Dobriakov, http://blog.geekQ.net

Copyright (c) Simon Rozet

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.