git的安装以及本地仓库的创建
安装git
- 检验是否安装
git --version
- 安装指令:
sudo apt-get install git -y
- 卸载指令:
sudo apt-get remove git -y
git本地仓库
创建本地仓库
- 将当前文件夹设置为git本地仓库命令:
git init
- 会生成一个 .git 文件,这个文件对该本地仓库进行管理
配置本地仓库
- 为本地仓库增加 name 和 email 这两个配置项。当给本地仓库提交内容时,需要先设置这两个配置项
- 配置命令:
git config
- 配置用户name:
git config user.name "用户名"
- 配置用户email:
git config user.email "实际email"
- 查看配置命令:
git config - l
- 删除配置项:
git config --unset 要删除的配置项
- 例如:
git config --unset user.name,git config --unset user.eamil
- --global选项:配置当前机器的所有本地仓库的配置项
- 例如:
git config --global user.name ,git config --global user.eamil
- --global选项新增的配置项不能被 --unset 直接删掉,需要在删除时也加上--global
- 例如:
git config --global --unset user.name