install git on linux,git for linux 安装

1. 从http://git-scm.com/download 下载最新版本的源码tar包,我下载的是git-1.7.2.3.tar.gz

2. # tar xzvf git-1.7.2.3.tar.gz

3. # cd git-1.7.2.3

4. # ./configure -prefix=/usr/local/git

5. # make install

注意在make时可能遇到没有找到zlib的错误,需要先安装zlib。 具体如何安装zlib请详见另外一篇blog

zlib 安装

[root@qa-CentOS56-64-2 git-1.7.2.3]# make

CC

fast-import.o

In file included from builtin.h:6,

from fast-import.c:147:

cache.h:17:18: error: zlib.h: No such file or directory

。。。

make: *** [fast-import.o] Error 1

6. 在~/.bachrc中加入export

PATH=/usr/local/git/bin:/usr/local/git/libexec/git-core:$PATH

这样可以直接用git命令而不是输入绝对路径才找到git

让文件生效# source ~/.bashrc

7. 验证安装成功

git

usage: 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]

[-c name=value] [--help]

COMMAND [ARGS]

The most commonly used git commands are:

add Add file contents to the index

bisect Find by binary search the change that introduced a bug

branch List, create, or delete branches

checkout Checkout a branch or

paths to the working tree

clone Clone a repository into a new directory

commit Record changes to the repository

diff Show changes between commits, commit and working tree, etc

fetch Download objects and refs from another repository

grep Print lines matching a pattern

init Create an empty git repository or reinitialize an existing

one

log Show commit logs

merge Join two or more development histories together

mv Move or rename a file, a directory, or a symlink

pull Fetch from and merge with another repository or a local

branch

push Update remote refs along with associated objects

rebase Forward-port local commits to the updated upstream head

reset Reset current HEAD to the specified state

rm Remove files from the working tree and from the index

show Show various types of objects

status Show the working tree status

tag Create, list, delete or verify a tag object signed with GPG

See 'git help COMMAND' for more information on a specific

command.

8. 使用git

create a free account on github website.

mkdir your working dirctory

add your ~/.ssh/id_rsa.pub to github-->Account

settings-->SSH Public Keys

cd your working dirctory

run git command to clone files from github "git clone git@github.com:geminitech/docs.git"

geminitech is team name or project name, docs is directory

name

内部的说明文档

相关链接:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值