Steps to host your master git repo and ikiwiki on separate machines with gitosis

  1. Cause ikiwiki to use a unprivileged, ikiwiki-only user. I'll assume you name this user 'ikiwiki'
    • This is mostly changing permissions so that the ikiwiki user can write to it's srcdir and destdir
    • This user needs a homedir as well
  2. Delete the wiki files from destdir and run ikiwiki -setup as your new ikiwiki user to make sure it runs correctly at this point.
  3. As the ikiwiki user, run ssh-genkey
  4. In ikiwiki/.ssh copy the file to authorized_keys
  5. Edit authorized_keys and place command="./update-iki",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty at the front of the line
  6. Edit your ikiwiki.setup file and change git_wrapper to /home/ikiwiki/update-iki
  7. Rerun ikiwiki -setup again
  8. Copy id_rsa (from .ssh) to the gitosis user's home directory (be sure to update the permissions, it must be owned by gitosis:gitosis and have 0600 permissions)
  9. As the gitosis user, run ssh ikiwiki@<ikiwikihost> ./update-iki
    • This will ask you to validate the host key, but should not ask for a password
  10. Configure gitosis for the new repository, ensure the public key for ikiwiki has write access to it
  11. Set the origin of the existing repo to gitosis
    • git remote add origin ssh://gitosis@<githost>/<ikiwikirepo>
  12. Push/pull to create the gitosis repo/update the branch info.
    • git push origin master;git pull
  13. Track the origin branch
    • git branch --set-upstream master origin/master
  14. On the gitosis host, find the new repo, and cd into its hooks directory
  15. Create/edit post-update with this line
    • ssh ikiwiki@<ikiwikihost> ./update-iki
      • AKA, the same command you ran earlier as gitosis
  16. Make post-update executable
  17. At this point, you should be finished, try adding/editing a page to make sure it all works
  18. If it doesn't work correctly (mine complained that an index.html file had been created independently so it wouldn't kill it), try removing all the wiki files again (keep the cgi file though) and pushing a commit through gitosis.
  19. Update the historyurl and diffurl variables (can be done in webconfig)