#系统版本 [root@git ~]# cat /etc/redhat-release CentOS Linux release 7.5.1804 (Core) #内核版本 [root@git ~]# uname -r 3.10.0-862.el7.x86_64 #关闭selinux [root@git ~]# getenforce Disabled #关闭防火墙 [root@git ~]# systemctl stop firewalld #查看iptables是否关闭 [root@git ~]# iptables-save
#系统自带git(如果没有,yum install git -y) [root@git ~]# yum install git -y [root@git ~]# git --version git version 1.8.3.1
[root@git ~]# git config usage: git config [options] Config file location --global use global config file #使用全局配置文件 --system use system config file #使用系统配置文件 --local use repository config file #使用库配置文件 -f, --file <file> use given config file #使用给定的配置文件 #配置git邮箱及用户: [root@git ~]# git config --global user.name "hujinzhong" #配置用户 [root@git ~]# git config --global user.email "hujinzhong@qq.com" #配置用户邮箱 [root@git ~]# git config --global color.ui true #配置语法高亮 [root@git ~]# git config --list #查看配置的相关信息 user.name=hujinzhong user.email=hujinzhong@qq.com color.ui=true #此时配置完后,会在本地生成一个隐藏的配置文件:.gitconfig #配置的用户及邮箱的相关信息 [root@git ~]# ll -a dr-xr-x---. 2 root root 169 Feb 27 18:17 . dr-xr-xr-x. 17 root root 224 Dec 10 13:27 .. -rw-r--r-- 1 root root 72 Feb 27 18:17 .gitconfig [root@git ~]# cat .gitconfig [user] name = hujinzhong email = hujinzhong@qq.com [color] ui = true
[root@git ~]# mkdir git_data [root@git ~]# cd git_data/ #初始化目录 [root@git git_data]# git init Initialized empty Git repository in /root/git_data/.git/ #初始化目录后会在本地生成一个隐藏的目录.git [root@git git_data]# ll -a total 0 drwxr-xr-x 3 root root 18 Feb 27 18:22 . dr-xr-x---. 3 root root 185 Feb 27 18:22 .. drwxr-xr-x 7 root root 119 Feb 27 18:22 .git [root@git git_data]# tree .git/ .git/ ├── branches #分支目录 ├── config #定义项目特有的配置选项 ├── description #描述信息 ├── HEAD #指针,指示当前的分支 ├── hooks #钩子文件目录 │ ├── applypatch-msg.sample │ ├── commit-msg.sample │ ├── post-update.sample │ ├── pre-applypatch.sample │ ├── pre-commit.sample │ ├── prepare-commit-msg.sample │ ├── pre-push.sample │ ├── pre-rebase.sample │ └── update.sample ├── info #包含一个全局排除文件(exclude文件) │ └── exclude ├── objects #存放所有的数据内容 │ ├── info │ └── pack └── refs #存放指向数据(分支)的提交对象的指针及标签 ├── heads └── tags 9 directories, 13 files //index #保存暂存区信息,在执行git init的时候,这个文件还没有
原文:https://www.cnblogs.com/hujinzhong/p/12187661.html