How to set GIT Username and email global in local computer?

Dung Do Tien Feb 12 2022 39

Hello, 

I have a project with asp.net core and use Git to manage source code. Yesterday I viewed all history committed, see image below:

How to set GIT Username and email global in local computer?

I didn't know why author is conta, maybe it's name of my computer and I want to change it to another author name. 

So how can I set git username in my local computer?

I'm using window 11. Vs 2022 and Git version 2.33.0.windows.2

Thankyou so much for any sugesstions.

Have 2 answer(s) found.
  • n

    nsir Feb 12 2022

    In the window, you can open Command Prompt (CMD) or Git bash and type the command below to check current git username in your computer:

    $ git config --global user.name

    If it returns "conta", it is correct.

    And to change this name to another, you can run the command below:

    $ git config --global user.name "YOUR_NAME"

    I hope it's useful for you.

  • G

    Gulam Feb 12 2022

    I. To change your Git username for every repository on your computer, You can do as below:

    1. Open Git Bash or Cmd.

    2. Change a Git username:

    $ git config --global user.name "YOUR_USERNAME"

    To check username changed or not:

    $ git config --global user.name 
    > YOUR_USERNAME

     

    II. Change your Git username for only one repository

    1. Open Git Bash or Cmd.

    2. Change the current working directory(folder) to the local repository where you want to configure the name that is associated with your Git commits.

    3. Change a Git username:

    $ git config user.name "YOUR_USERNAME"

    4. Confirm that you have set the Git username correctly:

    $ git config user.name
    > Mona Lisa
    
Leave An Answer
* NOTE: You need Login before leave an answer

* Type maximum 2000 characters.

* All comments have to wait approved before display.

* Please polite comment and respect questions and answers of others.

Popular Tips

X Close