Setting up CGIT to show root directories only

CGIT is a nice, quick, and easy way of displaying git repositories. After much fighting I figured out how to allow CGIT to display URLs such as http://code.example.com/repository.git (the git is optional).

Below is the Apache config for code.example.com:

<VirtualHost *:80>
    ServerName code.example.com
    DocumentRoot /var/www/code.example.com
    CustomLog logs/code.example.com.access_log combined
    ErrorLog logs/code.example.com.error_log
    SetEnv CGIT_CONFIG          /var/www/code.example.com/cgitrc
    Alias /cgit.css             /var/www/code.example.com/cgit.css
    Alias /cgit.png             /var/www/code.example.com/cgit.png
    Alias /favicon.ico          /var/www/code.example.com/favicon.ico
    Alias /robots.txt           /var/www/code.example.com/robots.txt
    Alias /                     /var/www/code.example.com/cgit.cgi/
    <Directory /var/www/code.example.com>
      Options Indexes FollowSymLinks
      Options +ExecCGI
      Order allow,deny
      Allow from all
      AddHandler cgi-script .cgi
      DirectoryIndex cgit.cgi
    </Directory>
</VirtualHost>

Displaying one category on your WordPress main page

If you would like to only display a single category on your WordPress main page, here’s how you do it. You will need to start out by getting ID of the category you wish to display.   In WordPress 2.7+,  start out by going to your categories tab under posts(1), then hover over the category you would like to display in your post(2), don’t click on it, just hover over it.  On the bottom of your screen, you will be shown then URL of the category your hover over(3), remember the ID number that being displayed.   In the below example the number we need to remember is “23”.

Getting Category id

After you have gotten your categories ID number, you will next need to change your index.php file.  In your index.php file look for the line with “have_post” and add the below code after.

<?php if (have_posts()) : ?>; Look for this line and add below
<?php query_posts('showposts=10&amp;;cat=23'); ?>;
<?php while (have_posts()) : the_post(); ?>;

Last, change “cat” to the category id from above. “showposts” is the number of posts to display on the page.

Displaying one category on your WordPress main page

If you would like to only display a single category on your WordPress main page, here’s how you do it. You will need to start out by getting ID of the category you wish to display.   In WordPress 2.7+,  start out by going to your categories tab under posts(1), then hover over the category you would like to display in your post(2), don’t click on it, just hover over it.  On the bottom of your screen, you will be shown then URL of the category your hover over(3), remember the ID number that being displayed.   In the below example the number we need to remember is “23”.

Getting Category id

After you have gotten your categories ID number, you will next need to change your index.php file.  In your index.php file look for the line with “have_post” and add the below code after.

<?php if (have_posts()) : ?> //Look for this line and add below
<?php query_posts('showposts=10&;cat=23'); ?>
<?php while (have_posts()) : the_post(); ?>

Last, change “cat” to the category id from above. “showposts” is the number of posts to display on the page.