전체 페이지뷰

2014년 1월 2일 목요일

How To Install Git on a CentOS 6.4

https://www.digitalocean.com/community/articles/how-to-install-git-on-a-centos-6-4-vps

How To Install Git on a CentOS 6.4 VPS


Git is an open source, distributed version control system developed by Linus Torvalds, the creator of Linux. It features trivial branching and merging, the ability to manage multiple remote repositories for a single project, and truly distributed development.
Although git is wonderful at managing large, complex projects with perhaps hundreds or thousands of contributors, it can also work extremely well for small projects with one person or a small team. This flexibility makes it a great choice for implementing version and source control for software projects of any size.
In this article, we will cover how to install git on a CentOS 6.4 server using yum, the CentOS package manager. We will then show how to install git from source in case you would like to benefit from the latest improvements.

How To Install Git Using Yum


sudo yum install git

How To Install Git from Source on CentOS


First, we need to download compilation tools for CentOS using the following command:
 
sudo yum groupinstall "Development Tools"

This will install the make tools and compilers needed to transform source code into binary executables.
Once this is complete, we will need to install some extra dependencies that git needs either to build or run:
 
sudo yum install zlib-devel perl-ExtUtils-MakeMaker asciidoc xmlto openssl-devel
 
Once these are installed, you can obtain the latest version of git from the code hosted on github.com:
 
cd ~
wget -O git.zip https://github.com/git/git/archive/master.zip
 
Unzip the archive and change into the project directory:

unzip git.zip
cd git-master
 
We can figure the package, build the executables and documentation, and then install it with the following set of commands:

make configure
./configure --prefix=/usr/local
make all doc
sudo make install install-doc install-html
 
To update git at a later date, you can actually use git! Clone the git repository on github into a new directory and then build and install it, as before:

git clone git://github.com/git/git

How To Set Up Git


When you commit changes with git, it embeds your name and email address into the commit message in order to easily track changes.
If we do not configure this information ourselves, git may try to guess these values (probably incorrectly) by using your Linux username and hostname.
Give git the values you wish to use for these parameters with these commands:

git config --global user.name "Your Name Here"
git config --global user.email "your_email@example.com"
 
The configuration changes will be stored in a file in your home directory. You can see them with a normal text editor:
 
nano ~/.gitconfig
[user]
        name = Your Name Here
        email = your_email@example.com
 
You can also view this information by querying git itself for the current configuration settings:

git config --list
user.name=Your Name Here
user.email=your_email@example.com
 
As mentioned earlier, if you forget to set up these steps, git may try to fill in these values automatically:

[master 0d9d21d] initial project version
 Committer: root 
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:

    git config --global user.name "Your Name"
    git config --global user.email you@example.com

After doing this, you may fix the identity used for this commit with:

    git commit --amend --reset-author
Depending on your version of git, it may fail entirely:
git commit
*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: empty ident name (for ) not allowed
As you can see, git is very good about telling you exactly what you should be doing.


git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git

git pull

댓글 없음:

댓글 쓰기