Christian Screen
Christian Screen

How to show or change your Git username or email address from terminal

Twitter
LinkedIn

As a basic refresher for most working on multiple coding projects or git-scm hosted accounts changing from one git account to another begs the question:

How do I see or change my Git (or github) username (usually email address)?

How to show your Git username – the basics

Use one of these methods:

  1. git config -get [user.name | user.email]
  2. git config –list
  3. or, open your git config file directly

Let’s examine each of these show your git username basics:

#1 – Use the command, git config -get [user.name | user.email]

git config user.name

This returns

Christian Screen

And if you enter git config user.email from the terminal from anywhere with your git initiated directory such as

git config user.email

this will return

cscreen@aiteamsuperstars.com

#2 – Use the command, ‘git config –list’

This approach shows all of the key configurations from your git config file, so entering the command from the terminal:

git config --list

will return the following:

credential.helper=osxkeychain
user.name=Christian Screen
user.email=cscreen@aiteamsuperstars.com

core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
core.precomposeunicode=true
remote.origin.url=https://github.com/aicglabs/datalakehouse.git

#3 – Use the ‘open your git config file directly’ approach via the terminal

If the above approaches for some reason did not work then open the file for reading/editing in your terminal window or favorite editor. Terminal window review and editing is recommended to avoid issues. Use the following command to view the global git settings:

vi ~/.gitconfig

This will open the VimEditor and your .gitconfig file should look something like this:

[user]
        name = Christian Screen
        email = cscreen@aiteamsuperstars.com

Since this is your ‘global’ git user information (using the user home director path, ~/) you could have a different settings in other projects you might be working on.

NB: I find it best that if you have a specific project you are contributing to and need to use different credentials for the contribution, you should clone the project and then within the project use the command line to change your user.name and user.email just for that local git repository clone project to not impact your global settings. This would look like this from the command line (notice the –global is missing):

git config user.name "Christian Contribution Project"
git config user.email "christian@personalemail.com"

Read below if you’d like to see how to change your global Git username or email address.

How to change your Git username – the basics

Changing your Git username is fairly straightforward. In your terminal window enter the following:

git config --global user.name "Christian The Architect"

You can then view the change directly in the ~/.gitconfig file or just use the ~/.gitconfig file to edit the user.name key/value pair directly in the Vim Editor as you see here:

vi ~/.gitconfig

Since this is again your global Git config file, be sure edit it carefully. Remember in the Vi(m) Editor, use the ‘Esc’ key and then type ‘wq’ and then press the ‘Return’ or ‘Enter’ key to write/save the file and exit.

How to change your Git email address – the basics

You can change your email address with the same process and command as you would your username using these commands from the terminal:

git config --global user.email "cscreen@aiteamsuperstars.com"

View any of your global changes (those made with the –global flag) using either command below:

cat ~/.gitconfig
vi ~/.gitconfig

Hopefully you’ll have success remembering these basic Git commands.

More to explorer

International Women's Day 2024

International Women’s Day 2024: Empowerment and Progress

As we commemorate International Women’s Day on March 8th each year, it’s a time to honor the resilience, accomplishments, and contributions of women worldwide. In 2024, this day holds particular significance as we take stock of the strides made, acknowledge persistent challenges, and recommit ourselves to the pursuit of gender equality.

Bank grade security

5 Steps to Configure Key Pair Authentication in Snowflake

Key pair authentication is a secure way to access your Snowflake data warehouse without relying solely on traditional username and password authentication. In this step-by-step guide, we will walk you through the process of setting up key pair authentication in Snowflake. We’ll also cover how to install OpenSSL, a crucial tool for generating the necessary key pair.

streamline-processes

Streamlining Your Bullhorn CRM: Mastering Duplicate Data Management

Discover the most effective strategies for eliminating duplicate records in your Bullhorn CRM. Duplicates can hinder your productivity, lead to data inaccuracies, and impact your relationships with clients and candidates. In this insightful session, we will guide you through best practices, cutting-edge tools, and proven techniques to ensure a clean and efficient CRM database.

Scroll to Top