Hosting Your Own Git Repository on fedora 12

This tutorial will covering common feature in git repository

  • commiting via ssh
  • Enable gitweb for web access
  • cloning anonymously using the Git protocol

    Install git, git-daemon

    # yum -y install git git-daemon gitweb
    

    Create a git user/group

    # useradd -U -d /var/cache/git -s /usr/libexec/git-core/git-shell git
    

    Make sure the permissions of the directory are correct

    # cd /var/cache
    # chown -R git:git git
    # chmod 755 git
    

    We’ll be using SSH keys for authenication, so collect the public keys of all the users who need commit access. Then, put the public keys into the right place

    # cd /var/cache/git
    # mkdir .ssh
    # chmod 700 .ssh
    # touch .ssh/authorized_keys
    # chmod 600 .ssh/authorized_keys
    (Put the public keys into authorized_keys, one per line)
    # chown -R git:git .ssh/
    

    → continue reading


Querying Visitor IP address

There are many ways, scripting/language to obtain remote IP address of the user who is browsing our website.

PERL

#!/usr/bin/perl
use CGI;
print "Content-type: text/plain; charset=iso-8859-1\n\n";
my $q = new CGI;
print "<b>Your Remote IP Address :" . $q->remote_host() . "</b>";

 PHP

<?php
echo "<b>Your Remote IP Address :" . $_SERVER['REMOTE_ADDR'] . "</b>";
?>

→ continue reading