一、创建版本库
1.1 装Git软件包
~ ] # yum -y install git
1.2 创建一个仓库
~ ] # mkdir lijunRepository //创建一个受git管理的仓库
~ ] # cd lijunRepository
~ ] # git init //初始化仓库
这个时候会在多出一个.git的隐藏文件,这个目录是Git来跟踪管理仓库的
二、把文件添加到版本库
2.1 在git仓库创建一个文件
~ ] # vim readme.txt ,内容如下:
Git is a version control system
2.2 用命令git add告诉Git,把文件添加到仓库
lijunRepository]# git add .
2.3 用命令git commit告诉Git,把文件提交到仓库
lijunRepository]# git commit -m '01'
三、更新文件内容
3.1 更新 readme.txt文件
~] # vim readme.txt
hello world #在最后一行添加hello world
3.2 查看文件现在状态和日志信息
~] # git status
~] # git log
3.3 再次提交版本
~] # git add .
~] # git commit -m "add hello world"
四、在客户端克隆仓库到本地
4.1 在客户端创建一个文件夹
~]# mkdir remoteRepository
4.2 进入文件夹同步远程仓库
remoteRepository ]# git clone 176.130.3.3:/root/lijunRepository/
最后输入远程主机的密码就可以了