vs code 提交代码弹框提示:请确保已在git中配置您的“user.name”和“user.email” ——解决方法

一、场景

修改完项目代码,准备提交到git上,结果提交失败,弹框提示:请确保已在Git中配置您的“user.name”和“user.email”

二、原因

新换了主机,重装了系统,安装git后还没有配置“user.name”和“user.email”。

三、解决办法

打开终端,运行以下配置命令:

$ git config --global user.name "your_username"  # 配置用户名
$ git config --global user.email "your_email"  # 配置邮箱

以上是全局配置“user.name”和“user.email”的命令,如果想要配置单个项目git的“user.name”和“user.email”,打开终端,进到该项目目录下,运行命令:

$ git config user.name "your_username"
$ git config user.email "your_email"

配置完,查看git中配置的用户名和邮箱,看看是否配置成功

$ git config user.name
$ git config user.email

记录于2023-02-24.

猜你喜欢

转载自blog.csdn.net/qq_40146789/article/details/129197252
今日推荐