配置 Git

安装 Git

  • 官网下载适合的 Windows 版软件
  • 安装 Git 并选择所有默认选项

安装完毕后就可以在命令行中运行 git

初次配置 Git

Tip

在开始使用 Git 之前需要配置 Git。在命令行工具中运行以下每行,确保所有选项都已被配置好。

bash
# 设置 Git 用户名
git config --global user.name "<Your-Full-Name>"
# 设置 Git 邮箱
git config --global user.email "<your-email-address>"
# 确保 Git 输出内容带有颜色标记
git config --global color.ui auto
# 对比显示原始状态
git config --global merge.conflictstyle diff3
# 列出所有的配置
git config --list

Git 与代码编辑器

配置 Git 使其能与代码编辑器结合使用。

bash
# VSCode 设置
git config --global core.editor "code --wait"
Tip

在安装 Git 时也可以进行该项设置

其他

配置终端命令提示符

Tip

参考:Udacity 的课程 Version Control with Git

  1. 下载所需的配置文件
  2. 根据 🎦 教程(Windows 版/Mac、Linux 版)进行操作

Copyright © 2024 Ben

Theme BlogiNote

Icons from Icônes