{"id":27954,"date":"2020-01-24T16:34:18","date_gmt":"2020-01-24T21:34:18","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=27954"},"modified":"2020-01-24T16:34:18","modified_gmt":"2020-01-24T21:34:18","slug":"setting-up-gitweb-on-shared-hosting","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2020\/01\/24\/setting-up-gitweb-on-shared-hosting\/","title":{"rendered":"Setting Up Gitweb on Shared Hosting"},"content":{"rendered":"<p><a href=\"https:\/\/belkadan.com\/blog\/2020\/01\/Gitweb-on-Shared-Hosting\/\">Jordan Rose<\/a> (<a href=\"https:\/\/twitter.com\/UINT_MIN\/status\/1220230265827516416\">tweet<\/a>):<\/p>\n<blockquote cite=\"https:\/\/belkadan.com\/blog\/2020\/01\/Gitweb-on-Shared-Hosting\/\"><p>I did get a few recommendations for other places to host Git repositories, but&mdash;at least partly inspired by Tom Ryder&rsquo;s &ldquo;<a href=\"https:\/\/sanctum.geek.nz\/why-not-github.html\">Why Not GitHub?<\/a>&rdquo;&mdash;I decided to take the plunge and set up my own hosting.<\/p>\n<p>[&#8230;]<\/p>\n<p>According to <a href=\"https:\/\/git-scm.com\/book\/en\/v2\/Git-on-the-Server-GitWeb\">the Git Book<\/a>, you&rsquo;re supposed to grab the latest sources and generate a custom version of the script yourself. What they don&rsquo;t mention is that pretty much everything you&rsquo;d customize by generating it yourself is already customizable with a config file.<\/p>\n<p>[&#8230;]<\/p>\n<p>The idea to use a RewriteRule is <a href=\"https:\/\/git-scm.com\/docs\/gitweb#_path_info_usage\">adapted from the gitweb man page<\/a>, but I&rsquo;ve made one important change: paths that resolve to real directories are <em>still sent to gitweb.cgi.<\/em><\/p>\n<p>[&#8230;]<\/p>\n<p>Basically, git doesn&rsquo;t normally keep around info for clones to work over plain HTTP, but we can generate it up front whenever there&rsquo;s a push. We use a <a href=\"https:\/\/git-scm.com\/docs\/githooks#post-update\">post-update hook<\/a> for that.<\/p><\/blockquote>\n\n<p>Previously:<\/p>\n<ul>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2020\/01\/16\/is-git-irreplaceable\/\">Is Git Irreplaceable?<\/a><\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>Jordan Rose (tweet): I did get a few recommendations for other places to host Git repositories, but&mdash;at least partly inspired by Tom Ryder&rsquo;s &ldquo;Why Not GitHub?&rdquo;&mdash;I decided to take the plunge and set up my own hosting. [&#8230;] According to the Git Book, you&rsquo;re supposed to grab the latest sources and generate a custom version [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2020-01-24T21:34:21Z","apple_news_api_id":"54576b4f-fb03-4b01-a43d-eef5417ad690","apple_news_api_modified_at":"2020-01-24T21:34:22Z","apple_news_api_revision":"AAAAAAAAAAD\/\/\/\/\/\/\/\/\/\/w==","apple_news_api_share_url":"https:\/\/apple.news\/AVFdrT_sDSwGkPe71QXrWkA","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[2],"tags":[544,377,524,30,163,96],"class_list":["post-27954","post","type-post","status-publish","format-standard","hentry","category-technology","tag-apache","tag-git","tag-github","tag-mac","tag-unix","tag-web"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/27954","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=27954"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/27954\/revisions"}],"predecessor-version":[{"id":27955,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/27954\/revisions\/27955"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=27954"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=27954"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=27954"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}