Git的基本设置

进入虚拟机环境中:首先我们对 Git 进行用户名和邮箱进行设置,请参照下面格式,替换为你自己常用的用户名和邮箱来完成设置:

$ git config --global user.name "Your Name"
$ git config --global user.email your@example.com

解释: --global 选项代表对 Git 进行全局设置。

接下来设置 Git 推送分支时相关配置:
$ git config --global push.default simple

此设置是 Git 命令 push 的默认模式为 simple,当我们执行 git push 没有指定分支时,自动使用当前分支,而不是报错。

1、对 Git 进行初始化
$ git init
2、将项目所有文件纳入到 Git 中
$ git add -A
3、检查 Git 状态:
$ git status
4、保留改动并提交:
$ git commit -m "Initial commit"
5、查看历史提交记录:
$ git log

原文地址:https://www.cnblogs.com/tirmer/p/8526381.html