一、Git 安装使用
1、 Git 安装配置
1、Yum 安装 Git
- Centos/RedHat 安装命令
[root@localhost ~]# yum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
# yum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
[root@localhost ~]# yum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
# yum -y install git-core
[root@localhost ~]# git --version
git version 1.8.3.1
2、源码安装
-
最新源码包下载地址:https://git-scm.com/download
-
安装系统的依赖包:
[root@qfedu.com ~]# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
- 解压下载的源码包:
[root@qfedu.com ~]# tar -zxf git-2.9.5.tar.xz
[root@qfedu.com ~]# cd git-2.9.5
[root@qfedu.com ~]# make prefix=/usr/local all
[root@qfedu.com ~]# make prefix=/usr/local install
2、Git 配置
1、Git 用户信息
- 配置个人的用户名称和电子邮件地址:
[root@localhost ~]# git config --global user.name "liqiufeng"
[root@localhost ~]# git config --global user.email 1922857947@qq.com
2、文本编辑器
- 设置Git默认使用的文本编辑器, 一般可能会是 Vi 或者 Vim。如果你有其他偏好,比如 Emacs 的话,可以重新设置::
[root@qfedu.com ~]# git config --global core.editor emacs
3、查看配置信息
- 要检查已有的配置信息,可以使用 git config --list 命令:
[root@localhost ~]# git config --list
user.name=liqiufeng
user.email=1922857947@qq.com
core.editor=emacs
二、安装本地 Git 服务器
1、创建用户初始化仓库
[root@localhost ~]# useradd git
[root@localhost ~]# passwd git
更改用户 git 的密码 。
新的 密码:
无效的密码: 密码少于 8 个字符
重新输入新的 密码:
passwd:所有的身份验证令牌已经成功更新。
[root@localhost ~]# mkdir /git-root/
[root@localhost ~]