Installing Git on CentOS 5


Installing Git on CentOS 5 is easy if you make use of the EPEL (Extra Packages for Enterprise Linux) repository. You’ll know if you’ve got this installed if the following fails:
yum install git
To setup EPEL all you need to do is create a file /etc/yum.repos.d/epel.repo and then paste in the following:
[epel]
name=Extra Packages for Enterprise Linux 5 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL

[epel-debuginfo]
name=Extra Packages for Enterprise Linux 5 - $basearch - Debug
#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch/debug
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-debug-5&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
gpgcheck=1

[epel-source]
name=Extra Packages for Enterprise Linux 5 - $basearch - Source
#baseurl=http://download.fedoraproject.org/pub/epel/5/SRPMS
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-source-5&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
gpgcheck=1
Now you can install using:
yum install git git-daemon

Creating and sharing a repository

Creating a repository is easy! Simply create a folder and type git init.
mkdir newrepo
cd newrepo
git init
Once created, we can copy/create our files (think svn import) and then do:
git add .
git commit
Once you’ve created a repository, you’ll probably want to share it. This means that other people can pull and push changes. There are a number of ways of accomplishing this. My usual method for sharing SVN repositories is via Apache; Git supports this as well. I think one of the simplest solutions is to use the Git Deamon. To allow others to pull and push you can share your Git repository using the following command:
git daemon --reuseaddr --base-path=/path/to/repos --export-all --verbose --enable=receive-pack
This command will share all repositories found within the folder /path/to/repos (so we would have created our “newrepo” folder within this location). Once shared you can clone the repository using the git resource locator syntax:
git clone git://remote.computer.hostname/newrepo
Or you can just use the IP address if you’d prefer.
You should now have a repository setup on a CentOS 5 server which you can clone and then pull/push updates.

Installing Git on CentOS 5 Installing Git on CentOS 5 Reviewed by Ricardo Castellanos on 9:17 Rating: 5

No hay comentarios:

Con la tecnología de Blogger.