GIT

GIT SETUP

Master – test06 (git.test.com:8765)

Backup – test12.

Steps to install GIt-web using apache

As root

#apt-get install git-core gitweb libapr1-dev libaprutil1-dev

#chmod -R 777 /usr/lib/git-core

#chmod 777 /etc/gitweb.conf

#vi /etc/gitweb.conf   ---- change the repository path as per requirement.

#chmod -R 777 /usr/share/gitweb

#adduser --system --shell /bin/bash --group  --home /home/git git

#su - git

As user git

#mkdir /home/git/repo

#cd downloads/

#wget http://www.us.apache.org/dist//httpd/httpd-2.4.17.tar.gz

#tar -zxf httpd-2.4.17.tar.gz

#cd httpd-2.4.17/

#./configure --prefix=/home/git/apache2 --enable-cgi --enable-cgid --enable-vhost-alias --enable-rewrite --enable-authnz-ldap --enable-so --enable-expires --enable-headers --enable-thread-safety --enable-ldap --with-port=8765

#make

#make install

#cd apache2/conf/

#vi httpd.conf

<strong>Uncomment modules and add entries that are missing
</strong>
LoadModule authnz_ldap_module modules/mod_authnz_ldap.so

LoadModule ldap_module modules/mod_ldap.so

LoadModule cgid_module modules/mod_cgid.so

LoadModule cgi_module modules/mod_cgi.so

LoadModule vhost_alias_module modules/mod_vhost_alias.so

LoadModule rewrite_module modules/mod_rewrite.so 

Add another conf file for git-web setup under ~/apache/conf

#vi git-http-site.conf   (check this file and make changes accordingly)

Then again open httpd.conf and add the below line in the end if the file.

Include conf/git-http-site.conf

IMP scripts

create_git_repo.sh (Create and initialiazes new bare repor in directory expose via http also setup back repo)

setup_mirror.sh (setups initial mirror for backup)

Steps to create New repository

#ssh root@test06

#su - git

#cd bin

git@test06:~bin$ ./create_git_repo.sh 

Provide the name of the repo (eg. project.git): .git

Then after login to test12 and run command below

#ssh root@test12

#su - git

#cd bin

#git@test12:~bin$ ./setup_mirror.sh

Provide the name of the repo (eg. project.git): .git  

Creating a new repository

Primary

git@test06:~/bin$ ./create_git_repo.sh hariproject1.git 

Provide the name of the repo (eg. project.git): hariproject1.git

Initialized empty Git repository in /home/git/repo/hariproject1.git/

Slave

git@test12:~/bin$ ./setup_mirror.sh

Provide the name of the repo (eg. project.git): hariproject1.git

Cloning into bare repository 'hariproject1.git'...

warning: You appear to have cloned an empty repository. 

On client side.

hari@test56:~$ git clone http://test06.test.com:8765/git/hariproject1.git hariproject1

hari@test56:~/hariproject1$ touch README

hari@test56:~/hariproject1$ touch sample.c

hari@test56:~/hariproject1$ vi sample.c

hari@test56:~/hariproject1$ git add README

hari@test56:~/hariproject1$ git add smaple.c

fatal: pathspec 'smaple.c' did not match any files

hari@test56:~/hariproject1$ git add sample.c

hari@test56:~/hariproject1$ git commit -m "some_message"

hari@test56:~/hariproject1$ git config --global user.email "hari@zedo.com"

hari@test56:~/hariproject1$  git config --global user.name "hari" 

Push the changes to the master repo

hari@test56:~/hariproject1$ git push origin master

hari@test56:~/hariproject1$ git push origin master

Username for 'http://test06.test.com:8765': hari

Password for 'http://hari@test06.test.com:8765':

Counting objects: 6, done.

Delta compression using up to 4 threads.

Compressing objects: 100% (3/3), done.

Writing objects: 100% (6/6), 462 bytes | 0 bytes/s, done.

Total 6 (delta 0), reused 0 (delta 0)

remote: To git@test12.test.com:/home/git/repo/hariproject1.git

remote:  * [new branch]      master -> master

To http://test06.test.com:8765/git/hariproject1.git

* [new branch]      master -> master 
Advertisements