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/gitlistI’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.
You need the following packages before you can setup GitList.
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
For setting up GitList, I am assuming the following directory paths and other variables.
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
In this segment, make sure you have AllowOverride All as below.
# Other lines omitted
AllowOverride All
# Other lines omitted
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.
]]>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.
]]>Assuming that all of us know at least one programming language (C/C++/Python), below is the list of things we are planning to learn.
We’ll learn these technologies while working regularly at our work places. Once in a while, we’ll meet and share our experiences and knowledge. The plan is to spend one or two weeks to go through basic stuff in all the topics. After that we can start a dummy rails project and learn more as we go.
If you are not in Hyderabad and still want to join, just start exploring and we can connect online! Happy Hacking!!!
]]>You can download latest version of twython from twython page on github. You can either clone using git (if you have git installed) or can click the download button.
Once you are done with extracting the downloaded tar file. Change directory to twython and run these command as root.
[root@fedora ~]$ git clone git://github.com/ryanmcgrath/twython.git
[root@fedora ~]$ cd twython/dist
[root@fedora dist]$ tar -xvzf twython-0.8.tar.gz
[root@fedora dist]$ cd twython-0.8/
[root@fedora dist]$ python setup.py build
[root@fedora dist]$ python setup.py install
Below is a direct copy paste lines from my interpreter. See how things are working (learning by doing).
[saini@bordeaux ~]$ python
Python 2.6 (r26:66714, Mar 17 2009, 11:44:21)
[GCC 4.4.0 20090313 (Red Hat 4.4.0-0.26)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> # first of all, import twython module
>>> import twython
>>> # Authenticate your twitter account with your twitter username
... # and password with twitter.setup method.
>>> client = twython.setup('Basic','myusername','mypassword')
>>> client.authenticated
True
>>> #Lets update our current status on twitter with some cool message.
>>> client.updateStatus('Testing #twython. The coolest #TwitterAPI :)')
>>> # Now go and check your current status on twitter. Surprised!!!
>>> # Get your or anyone's followers
>>> client.getFollowersIDs(screen_name='gofedora')
>>> # Output truncated.
>>> # Get help for any function.
>>> print client.createFriendship.__doc__
createFriendship(id = None, user_id = None, screen_name = None, follow = "false")
Allows the authenticating users to follow the user specified in the ID parameter.
Returns the befriended user in the requested format when successful. Returns a
string describing the failure condition when unsuccessful. If you are already
friends with the user an HTTP 403 will be returned.
Parameters:
** Note: One of the following is required. (id, user_id, screen_name)
id - Required. The ID or screen name of the user to befriend.
user_id - Required. Specfies the ID of the user to befriend. Helpful for disambiguating when a valid user ID is also a valid screen name.
screen_name - Required. Specfies the screen name of the user to befriend. Helpful for disambiguating when a valid screen name is also a user ID.
follow - Optional. Enable notifications for the target user in addition to becoming friends.
>>>
So now you are ready to do wonders with twython. Write your own code and blog/brag about it
Setting up gitweb (web interface for SCM software git) for your project’s git repository for public access and developer commits via ssh.
Project : VideoCache
Domain for gitweb : git.cachevideos.com
URL for git access for videocache : http://git.cachevideos.com/videocache.git
Actual path on server : /home/saini/domains/cachevideos.com/git
Git repository : /home/saini/projects/videocache/
Installation is pretty easy. Just one single command would do everything.
[root@localhost ~]# yum install gitweb (do as root)
This will create a directory /var/www/git which is default for gitweb.
Copy the directory /var/www/git/ to /home/saini/domains/cachevideos.com/git
[root@localhost ~]# cp -r /var/www/git /home/saini/domains/cachevideos.com/git
1. GitWeb
Open the file /etc/gitweb.conf (it may or may not be there) and add the following lines to it.
# Change This
$projectroot = '/home/saini/domains/cachevideos.com/git';
# Change This
$site_name = "Kulbir Saini's git trees.";
# Don't Change the variables below
$my_uri = "/";
$home_link = '/';
@stylesheets = ("/gitweb.css");
$favicon = "/git-favicon.png";
$logo = "/git-logo.png";
2. Apache
Open the file /etc/httpd/conf.d/git.conf and clear all the lines that are already there and add the following lines to it
DocumentRoot /home/saini/domains/cachevideos.com/git
ServerName git.cachevideos.com
ErrorLog "/home/saini/domains/cachevideos.com/logs/error_log"
CustomLog "/home/saini/domains/cachevideos.com/logs/access_log" combined
SetEnv GITWEB_CONFIG /etc/gitweb.conf
DirectoryIndex gitweb.cgi
Allow from all
AllowOverride all
Order allow,deny
Options +ExecCGI
AddHandler cgi-script .cgi
SetHandler cgi-script
RewriteEngine on
RewriteRule ^[a-zA-Z0-9_\-]+\.git/?(\?.*)?$ /gitweb.cgi%{REQUEST_URI} [L,PT]
3. Git repository configuration
Go to your git repository (/home/saini/projects/videocache/) and make the following changes.
(a). Open file .git/description and add a short nice description for your project.
videocache is a squid url rewriter plugin written in Python to facilitate youtube, metacafe, dailymotion, google, vimeo, msn soapbox, tvuol.uol.com.br, blip.tv, break.com videos and wrzuta.pl audio caching.
(b). Open file .git/config and append the following lines
[gitweb]
owner = "Kulbir Saini"
Copy the /home/saini/projects/videocache/.git directory to /home/saini/domains/cachevideos.com/git/videocache.git
[root@localhost ~]# cp -r /home/saini/projects/videocache/.git /home/saini/domains/cachevideos.com/git/videocache.git
Restart Apache webserver.
[root@localhost ~]# service httpd restart
Now you can browser a list of your projects’ git repositories at http://git.cachevideos.com/ .
Just copy the project repository’s .git directory to /home/saini/domains/cachevideos.com/git/prjoect_name.git. And it’ll be shown on the list.
For committing to the repository via ssh use the following command.
# Pushing everything (Please see the username)
[root@localhost videocache]# git push --all ssh://saini@git.cachevideos.com/~saini/domains/cachevideos.com/git/videocache.git
To update tags on the remote repository use this command.
# Pushing all tags
[root@localhost videocache]# git push --tags ssh://saini@git.cachevideos.com/~saini/domains/cachevideos.com/git/videocache.git
Well, if you consider just the web interface and committing part for your project, thats all. But things can be fine tuned further. Below are few hacks!
1. Enabling nice urls.
By default the urls for browsing repository via git web are pretty crappy and difficult to remember. The RewriteRule and RewriteEngine lines in your Apache configuration file (/etc/httpd/conf.d/git.conf) takes care of that and produce nice and clean urls.
So you can browser the repository via http://git.cachevideos.com/videocache.git instead of http://git.cachevideos.com/?p=videocache.git;a=summary.
2. Enabling remote ls (git-ls-remote or git ls-remote)
This is the most trickiest part. If you try the command below, it won’t produce any output
[root@localhost ~]# git-ls-remote http://git.cachevideos.com/videocache.git
You need to go to project’s repository in gitweb and then run the following command to update the server info for git.
[root@localhost ~]# cd /home/saini/domains/cachevideos.com/git/videocache.git/
[root@localhost ~]# git-update-server-info
Try the ls-remote command now and it should succeed by producing all the branches and tags in the remote repository.
But there is a problem, you have to run the above command after every commit to the remote repository. To solve this issue, you can enable post-update hook for the project’s repository in gitweb. Use the following command to enable it.
[root@localhost ~]# cd /home/saini/domains/cachevideos.com/git/videocache.git/
[root@localhost ~]# chmod +x post-update
The above command will update the server info automatically every time you commit.
Thats all you need to do for setting up gitweb. I hope this will be helpful.
We are the world leaders in providing best MB5-858 and MB6-818 prep solutions. Our incredible offers for MB7-840 and 70-297 exams are accessible at reasonable prices; 70-236 is very rare in IT world sense.
]]>