progect106-1/README.md
2026-01-08 23:41:05 +08:00

44 lines
1020 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 如何设置Git用户名和邮箱
## 步骤1检查Git是否安装
打开命令提示符或PowerShell输入以下命令
```bash
git --version
```
如果显示Git版本信息则Git已安装否则需要先安装Git。
## 步骤2设置全局用户名和邮箱
在命令提示符或PowerShell中输入以下命令
```bash
# 设置用户名
git config --global user.name "st2411020210"
# 设置邮箱
git config --global user.email "208035324@qq.com"
```
## 步骤3验证设置是否成功
输入以下命令查看当前的Git配置
```bash
git config --list
```
如果看到类似以下输出,则设置成功:
```
user.name=st2411020210
user.email=208035324@qq.com
```
## 注意事项
- 全局设置会应用到所有Git仓库
- 如果只想在特定仓库中设置不同的用户名和邮箱,可以在该仓库目录中运行相同的命令,但省略`--global`参数
- 确保使用真实的邮箱地址这将用于Git提交记录和GitHub/GitLab等平台的身份验证