Insanely Awesome Web Interface for Your Git Repos

Almost 80-90 people visit How To: Install and Configure GitWeb everyday in search of setting up a web interface for their git repositories. Though gitweb is nice, it’s a bit painful to setup and the web interface is not that appealing. The other day I received this email from Klaus Silveira

Hello Kulbir,
I saw your article about installing Gitweb and i decided to send this shameless self-promotion. Maybe you could try my open-source project, GitList https://github.com/klaussilveira/gitlist

I’m looking for beta testers and supporters. FLOSS. 🙂

So, I thought I’ll just give it a try. Today, I got it working and was blown away by the amazing interface! It’s almost like a super simplified version of GitHub. I was so impressed that I immediately setup a demo website at git.gofedora.com for others to look at and fall in love :-)Another good thing about GitList is that it’s very simple to setup. Below is a step by step process to install and configure GitList to expose your public Git repositories to the internet.

What You Need?

You need the following packages before you can setup GitList.

Installing Required Packages

Most modern operating systems have the above mentioned packages installed by default. Even if you don’t have them already, you can use your OS package manager to install them quickly. To install on Fedora/RedHat/CentOS using yum, use the following command

[root@whitemagnet.com ~]$ yum install php git httpd

For Ubuntu/Debian, use the following command

[root@whitemagnet.com ~]$ apt-get install php git apache2

Assumptions

For setting up GitList, I am assuming the following directory paths and other variables.

  • Path to public Git repositories : /home/saini/code/public/
  • Path to Apache document root : /var/www/html/
  • Path to Git executable : /usr/bin/git (Use “which git” to find out for your OS)
  • Web URL for browsing git repos : mygit.example.com/gitlist/

Installing and Configuring GitList

Follow the following simple steps to install and configure GitList.

Step 1 : Clone GitList repository from GitHub to /var/www/html/gitlist/

[root@whitemagnet.com ~]$ cd /var/www/html/
[root@whitemagnet.com html]$ git clone git://github.com/klaussilveira/gitlist.git gitlist

Step 2 : Create cache directory and make it globally writable

[root@whitemagnet.com ~]$ cd gitlist
[root@whitemagnet.com gitlist]$ mkdir cache
[root@whitemagnet.com gitlist]$ chmod 777 cache

Step 3 : Configure GitList using config.ini

Open the config.ini (in gitlist directory) and set the option properly. Refer the sample shown below.

[git]
client = '/usr/bin/git' ; Your git executable path
repositories = '/home/saini/code/public/' ; Path to your repositories (with ending slash)
 
[app]
baseurl = 'http://mygit.exmaple.com/gitlist' ; Base URL of the application (without ending slash)

Step 4 : Make sure your Apache can read your .htaccess file in gitlist directory

GitList utilizes Apache’s mod_rewrite module to  provide nice URLs. Make sure your Apache is configured to read .htaccess from the gitlist directory. Open your Apache config file (generally located at /etc/httpd/conf/httpd.conf or /etc/apache2/ports.conf) and look for the following

<Directory "/var/www/html">

In this segment, make sure you have AllowOverride All as below.

<Directory "/var/www/html">
# Other lines omitted
AllowOverride All
# Other lines omitted
</Directory>

Step 5 : Reload or restart Apache daemon if needed

[root@whitemagnet.com ~]$ apachctl -k restart (or apache2ctl -k restart for Ubuntu/Debian)

Step 6 : Get some sample repositories in your public repo directory

Get some sample repositories in your public repo directory from GitHub.

[root@whitemagnet.com ~]$ cd /home/saini/code/public/
[root@whitemagnet.com ~]$ git clone git://github.com/kulbirsaini/intelligentmirror.git
[root@whitemagnet.com ~]$ git clone git://github.com/kulbirsaini/Railscasts-Sync.git
[root@whitemagnet.com ~]$ git clone git://github.com/zilkey/active_hash.git

That’s all! Now, go to http://mygit.example.com/gitlist to discover your public git repos via a cool web interface! Leave a comment if you face any issues.

 

Getting Started With Git

I have been using Git for years now and I am still a novice user. Actually, if you are an individual developer or work in a really small team, you don’t really need to go beyond using the basic stuff like cloning a repo, committing code, branching and pushing back to the origin repo. And that’s exactly what happened with me. Working alone most of the times and working in my own repos. I never felt the need to explore advanced usage.

Last week, we didn’t have internet at home for like four days. So, I thought I’ll read a book. I downloaded ProGit : The Free Git Book and started reading. It’s an awesomely written book. I learned a lot of new things about Git. A few more concept about using branches efficiently. If you are a Git beginner or looking forward to getting started with Git and you don’t like reading too much, I’ll suggest that you read at least first three chapters thoroughly. That along with a free GitHub account should be enough to get you going if you are not going to be a heavy Git user soon.

 

Javascript To Remove All Facebook Apps From Your Account

This is a guest post by Gaganpreet Arora AKA bitgeek.

My Facebook app list was cluttered with useless apps accumulated over the time I had joined Facebook. The worst thing is that Facebook does not allow you to remove multiple apps in one go. You have to select one, confirm on “Are you sure?” first and then click on “Okay” when it is deleted. Very cumbersome. So I wrote a Javascript hack to remove all of the apps in one go.

Warning: This will actually delete all the apps

Step 1

Go to: http://www.facebook.com/editapps.php?v=allowed.

Step 2

Select and copy the complete code below and paste it into the address bar.

javascript:
function postwith (to,p)
{
  var myForm = document.createElement("form");
  myForm.method="post" ; myForm.action = to ;
  for (var k in p)
  {
    var myInput = document.createElement("input") ;
    myInput.setAttribute("name", k) ;
    myInput.setAttribute("value", p[k]);
    myForm.appendChild(myInput) ;
  }
  document.body.appendChild(myForm) ;
  myForm.submit() ;
  document.body.removeChild(myForm) ;
}
 
function getElementsByClassName(classname, node)
{
  if (!node)
  {
    node = document.getElementsByTagName('body')[0];
  }
  var a = [], re = new RegExp('\\b' + classname + '\\b');
  els = node.getElementsByTagName('*');
  for (var i = 0, j = els.length; i &lt; j; i++)
  {
    if ( re.test(els[i].className) )
    { a.push(els[i]); }
  }
  return a;
}
 
var arr = [];
els=document.getElementsByClassName('app_row');
arr['fb_dtsg']=document.getElementsByName('fb_dtsg')[0].value;
arr['remove'] = 1;
arr['post_form_id_source']='AsyncRequest';
arr['post_form_id'] = document.getElementById('post_form_id').value;
arr['app_id']=els[0].id.replace("editapps_allowed_","");
arr['__a'] = 1;
for (i=0; i
<h3><span style="text-decoration: underline;"><strong>Step 3</strong></span></h3>
Press Enter.
 
The browser may get stuck for a few moments if the list is large, so if it does, just wait a bit and it will respond back.
<h3><span style="text-decoration: underline;"><strong>References</strong></span></h3>
Function postwith was taken from <a href="http://mentaljetsam.wordpress.com/2008/06/02/using-javascript-to-post-data-between-pages/">here</a>, and getElementsByClassName was taken from <a href="http://snipplr.com/view/1696/get-elements-by-class-name/">here</a>.
 

Tip: Multiproxy Switch : Easily use multiple proxies in Firefox

A lot of people (especially working people with mobile devices like notebook/netbooks) need to use different proxy servers at home and office. There are several Firefox extensions available to achieve the required functionality but IMHO Multiproxy Switch(Mozilla Addon Page) is the best because

  1. Its simple and easy to use. It does what it should. No fancy/extra terrestrial stuff. Just switch proxies 🙂
  2. Easy and Firefox like interface to specify different proxies. Many extensions add their own fancy interfaces for specifying proxies which eventually suck big time.
  3. I am a fan of this one. The No-Proxy list. I could never understand those regular expression based no-proxy lists in FoxyProxy. Multiproxy Switch has Firefox like No-Proxy list which rocks and understandable 🙂

If you happen to come across a better proxy switcher for Firefox, do let us know 🙂

 

How To: Save yourself from stupid Tech Support Questions

Almost every other geek is pwned by his friends or people he/she knows by their stupid tech support questions. And sometime they drag you to the limits that you get frustrated enough to shoot yourself and bang your head onto your computer screen 😛 How on earth can someone be so stupid 😛 But luckily I found a Pidgin Plugin called STFW(Search The F**king Web). This is one really awesome plugin I have seen recently and I (and most other geeks) needed something like this for ages 🙂

What it does?

When somebody asks you a question, you can reply back with relevant keywords from the message you received prefixed with the command /stfw. The plugin will automatically convert the keywords to a URL understood by the site Let Me Google That For You (lmgtfy.com) and asker will get a URL like this http://lmgtfy.com/?q=what+is+http.

How to use?

The Download, installation and usage instruction can be seen on plugin page. So, when someone ask you “Wireless not working on my laptop”, just reply back with the following message

/stfw Wireless not working on my laptop

C’mon guys, ask me tech support questions 😛