INSTALLING GIT
最简单的方式是使用yum安装
# yum install git Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile ...[SNIP]... Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package git.x86_64 0:1.7.1-3.el6_4.1 will be installed --> Processing Dependency: perl-Git = 1.7.1-3.el6_4.1 for package: git-1.7.1-3.el6_4.1.x86_64 --> Processing Dependency: perl(Git) for package: git-1.7.1-3.el6_4.1.x86_64 --> Running transaction check ---> Package perl-Git.noarch 0:1.7.1-3.el6_4.1 will be installed --> Finished Dependency Resolution Dependencies Resolved ...[SNIP]... Installed: git.x86_64 0:1.7.1-3.el6_4.1 Dependency Installed: perl-Git.noarch 0:1.7.1-3.el6_4.1 Complete!
如果你想使用源代码进行安装,首先,需要先安装依赖。
$ sudo yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel -y Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile ...[SNIP]... Updated: libcurl-devel.x86_64 0:7.19.7-37.el6_5.3 openssl-devel.x86_64 0:1.0.1e-16.el6_5.15 Dependency Updated: curl.x86_64 0:7.19.7-37.el6_5.3 libcurl.x86_64 0:7.19.7-37.el6_5.3 openssl.x86_64 0:1.0.1e-16.el6_5.15 Complete! Download Git. # wget https://github.com/git/git/archive/master.zip --2014-09-10 12:22:46-- https://github.com/git/git/archive/master.zip ...[SNIP]... 2014-09-10 12:22:48 (3.37 MB/s) - "master.zip" saved [6192829/6192829] # unzip master.zip Archive: master.zip 0c72b98f31bf6eabd75be565a08ffcf0d8e74b1f ...[SNIP]... git-master/RelNotes -> Documentation/RelNotes/2.2.0.txt Run make. # make prefix=/usr/local all GIT_VERSION = 2.1.0.GIT ...[SNIP]... GEN bin-wrappers/test-subprocess GEN bin-wrappers/test-svn-fe GEN bin-wrappers/test-urlmatch-normalization GEN bin-wrappers/test-wildmatch GEN git-remote-testgit Install Git. # make prefix=/usr/local install GEN perl/PM.stamp SUBDIR perl ...[SNIP]...
设置Git服务器
通常的做法是设置Git服务器以简化Git存储库。 创建Git服务器涉及的步骤包括:
- Dedicate a server to Git.
- Install Git.
- Create a git user.
- Copy your secure shell (SSH) public keys into authorized keys for git user.
- Initialize a bare repository on the server.
- Clone the repository from your desktop.
- Check in files in the repository.
- Push the repository back to the server.
# yum install git –y # useradd git # su - git $ mkdir .ssh $ cd .ssh $ cat <your-ssh-public-key> >> authorized_keys $ cd $HOME $ mkdir postfix.git $ cd postfix.git $ git -–bare init $ exit # su – <your-user-name> $ git clone git@localhost:/home/git/postfix.git $ touch myfile $ git add myfile $ git commit –am “initial commit” $ git push origin master
本文暂时没有评论,来添加一个吧(●'◡'●)