CentOS6.4 VPS安装Git

Git是一个开源的分布式版本控制系统由Linus Torvalds,Linux的创造者。 它功能简单的分支和合并,为单个项目管理多个远程仓库,和真正的分布式开发。html

尽管git是美好的在管理大型、复杂的项目也许成百上千的贡献者,它还能够为小型项目工做很是好与一我的或一个小团队。 这种灵活性使它实现版本的一个很好的选择,为任何规模的软件项目源代码控制。linux

在本文中,咱们将介绍如何安装CentOS 6.4服务器使用git 百胜 CentOS包管理器。 咱们将展现如何从源代码安装git,以防你想从最新的改进中获益。git

如何安装Git使用Yum

和大多数Linux发行版同样,git是能够从CentOS的默认存储库。 咱们能够安装包维护者的最新版本:github

sudo yum install git

你要确认安装“y”型。 后来,git将安装并可使用了。服务器

如何安装Git在CentOS从源代码吗

若是你想要最新版本的git,最好下载最新版本从源代码和编译。编辑器

CentOS的版本库1.7.1上在撰写本文时,最新版本的git 1.8.4,这是一个很大的不一样之处。分布式

首先,咱们须要下载编译工具CentOS使用如下命令:ide

sudo yum groupinstall "Development Tools"

这将安装制造工具和编译器须要将源代码转换成二进制可执行文件。工具

一旦完成,咱们将须要安装一些额外的依赖,git须要创建或运行:this

sudo yum install zlib-devel perl-ExtUtils-MakeMaker asciidoc xmlto openssl-devel

一旦这些安装,您能够得到最新版本的代码托管在git github.com :

cd ~
wget -O git.zip https://github.com/git/git/archive/master.zip

解压存档和变动到项目目录:

unzip git.zip
cd git-master

咱们能够图方案,构建可执行文件和文档,而后安装它下面的命令:

make configure
./configure --prefix=/usr/local
make all doc
sudo make install install-doc install-html

更新git在稍后的日期,你可使用git ! 克隆git存储库在github上到一个新目录,而后构建和安装它,像之前同样:

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

如何设置Git吗

与git提交更改时,它嵌入您的姓名和电子邮件地址提交消息为了轻松地跟踪变化。

若是咱们不配置这些信息本身,git可能试图猜想这些值(多是错误的)经过使用您的Linux用户名和主机名。

给git您但愿使用这些参数值与这些命令:

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

配置更改将存储在一个文件在您的主目录。 你能够看到他们一个普通的文本编辑器:

nano ~/.gitconfig
[user]
        name = Your Name Here
        email = your_email@example.com

您还能够查看这些信息经过查询git当前配置设置:

git config --list
user.name=Your Name Here
user.email=your_email@example.com

如前所述,若是您忘了设置这些步骤,git可能试图填补这些值自动:

[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

根据您的git版本,它彻底可能会失败:

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

如您所见,git是很好的告诉你你应该作什么。

相关文章
相关标签/搜索