While it provides an efficient, organized web front-end for your personal git repositories, the cgit application is missing a few of the more sparkling features found at github–notably, a comments/discussion system. Enter: disqus.
First, build an HTML file to fire off a document URL comparison that decides whether or not the current page warrants the injection of the disqus platform (be sure to replace REPLACE-WITH-YOUR-DISQUS-SHORTNAME in the code below):
The code above will only inject the disqus platform on version-specific commit summaries and individual file views. (Without the version specificity, there would be no “hard” context to tie the discussion thread to.) It also prevents the platform from being injected on side-by-side diffs, since this would lead to two different contexts for discussions about the same file version/commit.
To include this newly-fashioned header in your cgit system, add the following line to your
cgitrc file (with the appropriate path, of course):
That’s it! The next time you visit a version-specific commit or file in your cgit system, the disqus comment thread should be injected at the bottom of the page.
Caveat: Currently, disqus has problems serving its script over HTTPS. If you’re serving cgit over HTTPS (and I am), you will unfortunately be plagued by content security mismatches. They claim that they have already fixed disqus to work over HTTPS, but I have experienced the opposite.
Update (2012/6/6): It looks like they’ve fixed the HTTPS problem.
Update (2012/7/24): You must disable the new Disqus 2012 features option if you’re forcing SSL, since it includes resources which are not served over an HTTPS connection.