Languages
[Edit]
EN

Git - how to set username and email?

2 points
Created by:
JustMike
3488

1. Overview

Usually we configure global username and email address after installing Git.

We can also set configuration for single specific repository.

In this post we cover both configurations:

  1. global (all repositories)
  2. single repository

Git configuration works the same under Windows, Linux and macOS.

2. Git - set global username and email configuration

  1. Open command line (eg git bash)
  2. Set your username:
    git config --global user.name "FIRST_NAME LAST_NAME"
  3. Set your email address:
    git config --global user.email "OUR_NAME@example.com"
  4. Verify your configuration by showing username and email
    # show username
    git config user.name
    # show email
    git config user.email

3. Git - set username and email configuration for single repository

  1. Open command line (eg git bash) and change directory into specific repository
  2. Set your username:
    git config user.name "FIRST_NAME LAST_NAME"
  3. Set your email address:
    git config user.email "OUR_NAME@example.com"
  4. Verify your configuration by showing username and email
    # show username
    git config user.name
    # show email
    git config user.email

Merged questions

  1. How to change username and email in git only for single local repository?

References

  1. Git config - Docs
  2. Getting Started - First-Time Git Setup
  3. Github - Setting your commit email addres
Hey 👋
Would you like to know what we do?
  • Dirask is a friendly IT community for learners, professionals and hobbyists to share their knowledge and help each other in extraordinary easy way.
  • We welcome everyone,
    no matter what the experience,
    no matter how basic the question is,
    this community will help you.