iCode : Do You Love Coding As Much As We Do ?
for a demo :
visit : http://inspirators.homelinux.net/iCode
iCode is a GIT hosting facility, with custom administration tool and web interface. Thus iCode is much much ahead of being just a normal git server.
I assume you have a decent knowledge of what GIT and version control is. In case you don't, here's the resource.
http://git-scm.com
Now, moving ahead.
Every Git clone is a full-fledged repository with complete history and full revision tracking capabilities, not dependent on network access or a central server. Branching and merging are fast and easy to do.
Pre-Installation
Before starting, make sure that:
1. You already have a Ubuntu 9.04 installed on your server.
2. You have a working internet connection.
The following instructions will guide you on how to set up and run a fully managed iCode for projects using git on your server.
We assume a setup of 2 Computers. The SERVER and the MANAGER.
On the SERVER
1. sudo apt-get install git-core
2. sudo apt-get install python-setuptools
3. cd ~/src
4. sudo git clone git@guthub.com:prince-mishra/mygitosis.git
5. cd mygitosis
6. python setup.py install
7. sudo adduser \
--system \
--shell /bin/sh \
--gecos ‘git version control’ \
--group \
--disabled-password \
--home /home/git \
git
On the MANAGER
8. ssh-keygen -t rsa
a. press “enter” two times
b. this generates a public/private RSA key and saves in /home/<username>/.ssh/id_rsa.pub
c. Transfer this key to the /tmp of the SERVER
On the SERVER
9. sudo -H -u git gitosis-init < /tmp/id_rsa.pub
10. sudo chmod 755 /home/git/repositories/gitosis-admin.git/hooks/post-update
On the MANAGER
11. cd /var/www
12. sudo git clone git@YOUR_SERVER_HOSTNAME:gitosis-admin.git
(If the cloning doesn't work, maybe you have PermitRootLogin no in the SSH server, and you need to add gitosis user to it.)
a. sudo vim /etc/ssh/sshd_config
b. AllowUsers git
13. cd gitosis-admin
14. Use your favorite editor to modify the contents of the mygitosis configuration file:
15. cd gitosis-admin
16. vim gitosis.conf
Adding a new project to the repository
Here is an example of the gitosis configuration file you clone before. Here it contains the default gitosis entry, and a new project entry:
[gitosis]
[group team]
writable = testproject
members = hostname.yourserver.com
[group gitosis-admin]
writable = gitosis-admin
members = keyfilename
hostname.yourserver.com or keyfilename is the name of the public key without .pub extension you copied into gitosis-admin/keydir/ directory.
17. After you've done editing, save the file, and commit it back to the server.
a. git commit -a -m "Added a new project"
b. git push
18. Any future projects will be added the same way.
Committing to the first project
To commit the project you just created, initiate a new git project, add files to it, commit it, then push it to your repository with the name you set up in gitosis config file.
19. mkdir testproject
20. cd testproject
21. git init
22. touch a_text_file.txt
23. git add .
24. git commit -a -m "Initial import"
25. git remote add origin gitosis@yourserver.com:testproject.git
26. git push origin master
The project should be committed!
Adding users
First, gather their public SSH keys, which I'll call "kakashi.pub" and "naruto.pub", and drop them into keydir/ of your local gitosis-admin repository. Second, edit gitosis.conf and add them to the "members" list.
27. cd gitosis-admin
28. cp ~/kakashi.pub keydir/
29. cp ~/naruto.pub keydir/
30. git add keydir/kakashi.pub keydir/naruto.pub
Note that the key filename must have a ".pub" extension.
gitosis.conf changes:
[group team]
writable = testproject
- members = hostname.yourserver.com
+ members = hostname.yourserver.com kakashi naruto
Commit and push:
31. git commit -a -m "Granted Kakashi and Naruto commit rights to testproject"
32. git push
That's it. Kakashi and Naruto can now clone the testproject repository like so:
33. git clone git@yourserver.com:testproject.git
Kakashi and Naruto will also have commit rights.
iCode Browser interface
34. sudo apt-get install apache2 libapache2-mod-php5 php-geshi
35. sudo git clone git@github.com:prince-mishhra/iCode.git
36. sudo chown -vR www-data:www-data iCode
37. After finishing this operation, use your favorite editor to edit the config file for iCode:
38. cd /var/www/iCode/inc
39. sudo cp config.php localconfig.php
40. sudo chown www-data:www-data localconfig.php
41. sudo vim localconfig.php
42. Here is an example of the iCode localconfig.php with GeSHI and the testproject.git we created:
<?php
$conf['projects'] = array(
'projectname' => array('repo' => '/home/git/repositories/testproject.git/'),
);
----------------------------------- Leave the remaining configuration settings
?>
a. Now in your browser, navigate to
http://localhost/iCode
b. You will see iCode right there. If there are any errors saying “permission denied”, provide adequate permissions on /home/git/repositories
Comments
Post a Comment