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.

  • 9
    点赞
  • 49
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值