Skip to content

Git

虽然 Gitee 有限支持 SVN,但纯文本版本控制,Git 是事实标准。

修改了 10 个文件,一次提交太乱,那就分多次提交,这就是 git addgit commit -m 两步的原因。

如果没有新增文件,也可以合并为 git commit -am

安装和配置

Ubuntu 一般预装了 Git ,使用 git -v 查看其版本。

Windows 需要自行安装 Git ,访问 https://git-scm.com/ ,下载代码仓库 https://github.com/git-for-windows/git 的安装包。 Windows 安装 Git ,附带安装 Git Bash ,可以使用 ssh、 openssl、 sed 等命令。

安装完成后,需要配置邮箱和用户名以供版本生成时使用,一般是全局配置使用参数 --global ,也可以局部配置不使用该参数,全局配置文件在 ~/.gitconfig 。

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

查看全局配置。

git config --global --list
user.email=your.email@abc.com
user.name=Your Name

生成 SSH 密钥,用于远程仓库。

联系 math@baima.site