Setting your email in Git

本文转载至:https://help.github.com/articles/setting-your-email-in-git/

简述:

使用下面的命令设置全局的邮箱。

git config --global user.email "your_email@example.com"


使用下面的命令设置本地的邮箱。(仅是当前的repo)

git config user.email "your_email@example.com"


GitHub uses the email address you set in your local Git configuration to associate commits with your GitHub account.

Setting your local Git email address using the git config command

The git config command can be used to change your Git configuration settings,including your email address. It takes two arguments:

  • The setting you want to change--in this case, user.email.
  • Your new email address--for example, your_email@example.com. Be sure to use your own real, unique email address.

Your email address will be visible on commits to GitHub. If you'd like to keep your email address private, set your Git config email to username@users.noreply.github.com instead, replacing username with your GitHub username. For more information, see "Keeping your email address private".

Setting your email address for every repository on your computer
  1. Open Terminal (for Mac and Linux users) or the command prompt (for Windows users).

  2. Set your email address with the following command:

    git config --global user.email "your_email@example.com"
    
  3. Confirm that you have set your email address correctly with the following command.

    git config --global user.email
    your_email@example.com
    
Setting your email address for a single repository

You may need to set a different email address for a single repository, such as a work email address for a work-related project.

  1. Open Terminal (for Mac and Linux users) or the command prompt (for Windows users).

  2. Change the current working directory to the local repository in which you want to set your Git config email.

  3. Set your email address with the following command:

    git config user.email "your_email@example.com"
    
  4. Confirm that you have set your email address correctly with the following command.

    git config user.email
    your_email@example.com
    

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值