设为首页 收藏本站
查看: 1072|回复: 0

[经验分享] git(学习之二)编译安装

[复制链接]

尚未签到

发表于 2018-9-17 13:25:15 | 显示全部楼层 |阅读模式
  Git学习笔记
  #####################################################
  qq:1218761836
  qq群:150181442
  #####################################################
  Git安装
  1.    Yum安装git
  yum install git –y
  yum install -y  git-email git-gui gitk git-svn git-cvs
  其中git-svn  git-cvs 是支持svn  cvs协同工作时需要(可选择)
  2.    开启git命令补齐功能(不过我测试不加这个也可以补齐)
  . /etc/bash_completion.d/git 或者source /etc/bash_completion.d/git
  #运行此命令后即可在服务器上使用git的命令补齐功能。为了能够在终端开启时自动加载bash_completion脚本,需要在系统配置文件/etc/profile及本地配置文件~/.bashrc 中添加下面的内容。
  #add  git
  if [ -f /etc/bash_completion.d/git ]; then
  . /etc/bash_completion.d/git
  fi
  当然这里/etc/bash_completion.d/git的git脚本也可以复制源文件替换,
  cp /usr/share/doc/git-1.7.1/contrib/completion/git-completion.bash /etc/bash_completion.d/
  然后把文件中涉及到的git替换成git-completion.bash即可
  参考: http://git-scm.com/download/linux
  编译安装
  编译安装需要安装一些git需要的库
  yum install curl-devel expat-devel gettext-devel  openssl-devel zlib-devel  gcc*  \
  perl perl-devel texinfo  xmlto   -y
  为了能够添加更多格式的文档(如 doc,html,info) 需要安装所依赖的包
  yum install asciidoc xmlto   -y
  docbook2x 这个库需要额外安装
  wget http://centos.karan.org/el5/extras/testing/i386/RPMS/docbook2X-0.8.8-1.el5.kb.i386.rpm
  rpm -ivh docbook2X-0.8.8-1.el5.kb.i386.rpm –nodeps
  cd /usr/bin/
  ln -s db2x_docbook2texi docbook2x-texi
  ll docbook2x-texi
  获取源码包:
  https://www.kernel.org/pub/software/scm/git/
  https://github.com/git/git/releases
  通常在 GitHub 上的是最新版本,但 kernel.org 上包含有文件下载签名,如果你想验证下载正确性的话会用到。
  wget https://www.kernel.org/pub/software/scm/git/git-2.5.0.tar.gz
  tar xvf git-2.5.0.tar.gz -C /usr/local/src/
  [root@wx git-2.5.0]# less INSTALL
  Git installation
  Normally you can just do "make" followed by "make install", and that
  will install the git programs in your own ~/bin/ directory.  If you want
  to do a global install, you can do
  $ make prefix=/usr all doc info ;# as yourself
  # make prefix=/usr install install-doc install-html install-info ;# as root
  (or prefix=/usr/local, of course).  Just like any program suite
  that uses $prefix, the built results have some paths encoded,
  which are derived from $prefix, so "make all; make prefix=/usr
  install" would not work.
  The beginning of the Makefile documents many variables that affect the way
  git is built.  You can override them either from the command line, or in a
  config.mak file.
  Alternatively you can use autoconf generated ./configure script to
  set up install paths (via config.mak.autogen), so you can write instead
  $ make configure ;# as yourself
  $ ./configure --prefix=/usr ;# as yourself
  $ make all doc ;# as yourself
  # make install install-doc install-html;# as root
  …………………………………………………………………………………………………………………………….
  [root@wx-a git-2.5.0]# make configure
  GIT_VERSION = 2.5.0
  GEN configure
  [root@wx-a git-2.5.0]# ./configure –help # 查看安装的参数
  [root@wx-a git-2.5.0]# ./configure --prefix=/application/git
  [root@wx-a git-2.5.0]# make all doc info
  [root@wx-a git-2.5.0]# make install install-doc install-html install-info
  .................................................................................................................................
  make[1]: Leaving directory `/usr/local/src/git-2.5.0/Documentation'
  make -C Documentation install-info
  make[1]: Entering directory `/usr/local/src/git-2.5.0/Documentation'
  make[2]: Entering directory `/usr/local/src/git-2.5.0'
  make[2]: `GIT-VERSION-FILE' is up to date.
  make[2]: Leaving directory `/usr/local/src/git-2.5.0'
  install -d -m 755 /application/git/share/info
  install -m 644 git.info gitman.info /application/git/share/info
  if test -r /application/git/share/info/dir; then \
  install-info --info-dir=/application/git/share/info git.info ;\
  install-info --info-dir=/application/git/share/info gitman.info ;\
  else \
  echo "No directory found in /application/git/share/info" >&2 ; \
  fi
  No directory found in /application/git/share/info
  make[1]: Leaving directory `/usr/local/src/git-2.5.0/Documentation'
  man git 查看git命令的使用说明
  [root@wx-a ~]# man git
  GIT(1)                            Git Manual                            GIT(1)
  NAME
  git - the stupid content tracker
  SYNOPSIS
  git [--version] [--exec-path[=GIT_EXEC_PATH]] [--html-path]
  [-p|--paginate|--no-pager] [--no-replace-objects]
  [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE]
  [--help] COMMAND [ARGS]
  DESCRIPTION
  Git is a fast, scalable, distributed revision control system with an unusually rich command set that provides both
  high-level operations and full access to internals.
  See gittutorial(7) to get started, then see Everyday Git[1] for a useful minimum set of commands, and "man
  git-commandname" for documentation of each command. CVS users may also want to read gitcvs-migration(7). See the Git
  User’s Manual[2] for a more in-depth introduction.
  The COMMAND is either a name of a Git command (see below) or an alias as defined in the configuration file (see git-
  config(1)).
  Formatted and hyperlinked version of the latest git documentation can be viewed at
  http://www.kernel.org/pub/software/scm/git/docs/.   #man   git的在线说明文档
  ......................................................................................................................................................................
  备注:编译的时候可能会遇到错误,如果遇到以下故障
  make的时候出错大都和依赖包有问题,如果安装的了相应的依赖包,编译起来很方便
  错误一
  /bin/sh: line 1: xmlto: command not found
  make[1]: *** [git-add.1] Error 127
  make[1]: Leaving directory `/usr/local/src/git-1.7.12.3/Documentation'
  make: *** [install-doc] Error 2
  依赖包的问题
  yum install -y xmlto
  错误二
  /bin/sh: line 1: docbook2x-texi: command not found
  make[1]: *** [user-manual.texi] Error 127
  make[1]: Leaving directory `/usr/local/src/git-1.7.12.3/Documentation'
  make: *** [install-info] Error 2
  git完整安装需要asciidoc,docbook2X
  yum install -y openjade  texinfo  perl-XML-SAX
  cd /usr/local/src
  wget http://centos.karan.org/el5/extras/testing/i386/RPMS/docbook2X-0.8.8-1.el5.kb.i386.rpm
  rpm -ivh docbook2X-0.8.8-1.el5.kb.i386.rpm --nodeps
  cd /usr/bin
  ln -s db2x_docbook2texi docbook2x-texi


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-588455-1-1.html 上篇帖子: git 服务器搭建及一些命令说明 下篇帖子: git push 时遇到的问题
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表