Error: no such theme PatternSkinTheme
-- JeffLeep - 2011-09-23

The following log file documents my setting up git on baran: (I used http://www.howtoforge.com/how-to-install-a-public-git-repository-on-a-debian-server as a guide)

First, I installed git:

/usr/bin/apt-get install git git-core git-doc git-gui gitk gitweb

(All of these packages were installed on Thomas, and I figured that I might as well install all of them on baran as well)

Then I cd'd into /misc and made a directory for our git repositories.

cd /misc
mkdir git

I then updated our apache configuration to include options for the gitweb directory.

On setup, I edited /setup/server/httpd/etc/apache2/conf.d/specialWebSites.conf and added the following lines:

# The options for gitweb, taken from 
# http://www.howtoforge.com/how-to-install-a-public-git-repository-on-a-debian-server

<Directory /usr/share/drupal6/git>
   Allow from all
   AllowOverride all
   Order allow,deny
   Options ExecCGI
   <Files gitweb.cgi>
   SetHandler cgi-script
   </Files>
</Directory>
DirectoryIndex gitweb.cgi
SetEnv  GITWEB_CONFIG  /etc/gitweb.conf

I then copied /setup/server/httpd/etc/apache2/conf.d/specialWebSites.conf to /etc/apache2/conf.d/specialWebSites.conf on baran:

/bin/cp /setup/server/httpd/etc/apache2/conf.d/specialWebSites.conf /etc/apache2/conf.d/specialWebSites.conf

On baran, I created the directory /usr/share/drupal6/git

/bin/mkdir /usr/share/drupal6/git

Then I copied gitweb.cgi, logo and css files into /usr/share/drupal6/git:

/bin/cp /usr/share/gitweb/* /usr/share/drupal6/git 
/bin/cp /usr/lib/cgi-bin/gitweb.cgi /usr/share/drupal6/git 

Then I reloaded the git configuration into apache:

/etc/init.d/apache2 reload

I also changed a line in /etc/gitweb.conf from:

$projectroot = "/var/www/git";

to

$projectroot = "/misc/git";

When I try to go to this site, it tells me that I do not have permission. Why not?

I changed the configuration in specialWebSites.conf on setup to:

<Directory /usr/share/drupal6/git>
   Allow from all
   AllowOverride all
   Order allow,deny
   DirectoryIndex gitweb.cgi
   SetEnv  GITWEB_CONFIG  /etc/gitweb.conf
   Options FollowSymLinks Indexes ExecCGI
   <Files gitweb.cgi>
   SetHandler cgi-script
   </Files>
</Directory>

Then restarted the apache server, and it worked!

Next, I began to install gitosis, following the guide I found at: http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way

First, I copied over gitosis:

cd /misc/git
/usr/bin/git clone git://eagain.net/gitosis.git

Next, I installed gitosis:

cd gitosis
/usr/bin/python setup.py install

However, I recieved the error: Traceback (most recent call last): File "setup.py", line 2, in from setuptools import setup, find_packages ImportError: No module named setuptools

Which means that I have to install python-setuptools

/usr/bin/apt-get install python-setuptools

Very well. Let's try this again.

/usr/bin/python setup.py install

wooooooo it worked!

Next, I added git as a user, with /var/lib/git as its home (the choice for a home directory is completely arbitrary)

    /usr/sbin/adduser \
    --system \
    --shell /bin/sh \
    --gecos 'git version control' \
    --group \
    --disabled-password \
    --home /var/lib/git \
    git

Then, as user leepjeff, I copied my public key into baran's temp directory:

  cp ~/.ssh/id_rsa.pub /tmp/id_rsa.pub

Next, I changed user to git

/bin/su git

and added my own public key to git's authorized_keys file:

/usr/local/bin/gitosis-init < /tmp/id_rsa.pub

I then made sure that post-update hook had the right permissions:

/bin/chmod 755 /var/lib/git/repositories/gitosis-admin.git/hooks/post-update

Here, I became very hungry and decided to leave + get some lunch because I cannot focus.

I realized that I actually did not want to store the git repositories in /var/lib/git, but rather in /misc/git, so I removed /var/lib/git

/bin/rm -R /var/lib/git

And I removed the user git:

/usr/sbin/deluser git

And I removed /misc/git (so that I could recreate it for the git user

/bin/rm -R /misc/git

Then I added the git user once more:

   /usr/sbin/adduser \
    --system \
    --shell /bin/sh \
    --gecos 'git version control' \
    --group \
    --disabled-password \
    --home /misc/git \
    git

Then I changed to the git user

/bin/su git

And once more added my public key to git's authorized_keys file:

/usr/local/bin/gitosis-init < /tmp/id_rsa.pub

It looks like it worked correctly, giving me the following messages:

Initialized empty Git repository in /misc/git/repositories/gitosis-admin.git/ Reinitialized existing Git repository in /misc/git/repositories/gitosis-admin.git/

Then I made sure that the permissions were correct for the post- update hook

/bin/chmod 755 /misc/git/repositories/gitosis-admin.git/hooks/post-update

There. We're back were we should be. Except this time with the correct home directory for the git user.

Now, back on Thomas, as leepjeff, I created a directory for my git repositories:

mkdir ~/git

Next, I cloned the gitosis-admin repository:

git clone git@baran:gitosis-admin.git

then, I went into the new gitosis-admin directory in my home directory

cd gitosis-admin

I edited the gitosis.conf file to give myself write priveleges to the new sysadmin repo I'm planning on making:

vi gitosis.conf

and added the following lines:

[group sysadmin-team]
writable = sysadmin
members = leepjeff@thomas

Then I committed the new configuration file:

git commit -a -m "giving leepjeff@thomas write access to sysadmin"
git push

Next in my ~/git folder, I created the new directory that will become our sysadmin git repository!

cd ~/git
mkdir sysadmin.git
cd sysadmin.git
git init
git remote add origin git@baran:sysadmin.git

Then I copied Prof. Stone's logs and my own logs into the ~/git/sysadmin directory.

cp -R ~/log ~/git/sysadmin.git/stone_logs
cp -R ~/logs ~/git/sysadmin.git/jeff_logs

git add .
git commit -a -m "Added Mr. Stone's logs, and added my own logs"
git push origin master:refs/heads/master

I also changed the /etc/gitweb.conf file replacing the line

$projectroot = "/misc/git";

with

$projectroot = "/misc/git/repositories";

However, gitweb still does not see our repositories because I have not given it access to them.

Next, I gave Martin permissions to read / write in the sysadmin repository.

I made a file in gitosis-admin/keydir/ directory called dluhosma.pub and copied Martin's ssh public key into it.

I then added that file:

git add dluhosma.pub

Next, I updated the gitosis.conf file, changing

[group sysadmin-team]
writable = sysadmin
members = leepjeff@thomas

to

[group sysadmin-team]
writable = sysadmin
members = leepjeff@thomas dluhosma

Then, I committed and pushed those changes.

git commit -a -m "granted Martin commit rights to the sysadmin repository."
git push

Martin can now read / write to the syadmin repository!
Topic revision: r1 - 2011-09-23, JeffLeep
 

This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback