git studyGit

Git 安装配置

2015-12-11  本文已影响535人  michael_jia

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

本文 以 Git 最新版 2.6.4 为例。Git 命令参考手册GitHub Cheat Sheet 值得花时间浏览一下。Pro Git 2nd Edition (2014) 是本好书,原理讲得到位,免费在线发布,有中文版。

本文以命令行使用方式的安装配置为主,GUI 版的相对简单。

Mac 环境


安装
配置

略。

Windows 环境


安装
配置

使用 Git Bash 命令行工具进行操作。

Linux 环境


源码安装 Book Pro Git Installing from Source
$ tar -xzf v2.6.4.tar.gz
$ cd git-2.6.4
$ make configure
$ ./configure --prefix=/usr
$ make all 
$ sudo make install

注:因为 Python 2.4 依赖的问题,doc, html, info 等形式的文档没有安装。

$ git --version
git version 2.6.4

yum install git # 不过,采用这种方式,只能安装为:1.8.3.1。

配置

git config # 对 git 进行配置

环境参数
$ cat /etc/centos-release
CentOS Linux release 7.1.1503 (Core)

参考


git config 配置文件
  1. 系统级文件 $(prefix)/etc/gitconfig
    本文即 /usr/etc/gitconfig 文件。
    git config --system 指定只操作系统级文件。初始不存在,若不存在则无影响。
  2. 用户级文件 ~/.gitconfig
    git config --global 指定只操作用户级文件。初始不存在,若不存在则无影响。
  3. Repository 级文件 .git/config
    --local 对写操作,则只写入 Repository 级文件(默认行为);对读操作,则只从 Repository 级文件读。
  4. --file config-file 则指定 config-file。
  5. 注:如果不特别指定哪个配置文件,则依 system/global/local 顺序读取,最后的值覆盖前面的,多值的则合并。
info 文件(work tree)

.git/info/refs
.git/objects/info/packs

2005-2015 十周年

上一篇 下一篇

猜你喜欢

热点阅读