1 安装
a: 直接安装
先搜索下git的包有哪些
aptitude show git
- Package: git
- New: yes
- State: installed
- Automatically installed: yes
- Version: 1:1.7.2.5-3
- Priority: optional
- Section: vcs
- Maintainer: Gerrit Pape <pape@smarden.org>
- Uncompressed Size: 10.8 M
- Depends: libc6 (>= 2.3.4), libcurl3-gnutls (>= 7.16.2-1), libexpat1 (>= 1.95.8),
- zlib1g (>= 1:1.2.0), perl-modules, liberror-perl
- Recommends: patch, less, rsync, ssh-client
- Suggests: git-doc, git-arch, git-cvs, git-svn, git-email, git-daemon-run,
- git-gui, gitk, gitweb
aptitude install git-doc git-svn git-email git-gui gitk gitweb
老的版本,debian lenny
aptitude install git-core
aptitude install git-doc git-svn git-email git-gui gitk
b:源码安装
访问http://git-scm.com 下载git源码包
tar -jxvf git-1.xxxx.tar.bz2
cd git-1.xxxx/
安装的在install文件里,直接参考下就可以完成安装
make prefix=/usr/local all
make prefix=/usr/local install
文档这些安装方法
make prefix=/usr/local doc info
make prefix=/usr/local install-doc install-html install-info
2 使用
git –version 查看git版本
git config –global 本用户的配置全局
git config –system 配置系统的参数
git config –global user.name “rainysia”
git config –global user.email rainysia@gmail.com
git config –system alias.st status 把git status简化成git st
git config –system alias.ci commit 把git commit 简化成git ci
git config –system alias.co checkout 把git checkout 简化成git co
git config –system alias.br branch 把git branch 简化成alias br
如果要配置本用户的,就把–system改成–global
git config –global color.ui true 开启颜色显示
3 建立工作区
mkdir /home/gitwork
cd /home/gitwork
git init
- Initialized emptyempty Git repository in /home/gitwork/.git/
查看git status 需要在gitwork目录下使用,通过strace -e ‘trace=file’ git status 来跟踪执行git status的磁盘访问