KoderSolution Logo
HomeArticlesTutorialsForumAI LabRun Code
KoderSolution Logo

The world’s most advanced technical ecosystem for modern software engineers. Learn, build, and grow with next-generation developer tools and resources.

Engineering Newsletter

Join 100,000+ engineers receiving curated high-signal content weekly.

Platforms

  • Technical Articles
  • Interactive Tutorials
  • AI Coding Lab
  • Developer Forum
  • Developer Tools

Pages

  • About Us
  • Contact Us
  • Privacy Policy
  • Terms of Service
  • Refund Policy
  • Disclaimer
  • Advertisement

Popular Topics

  • PHP
  • Laravel
  • Python
  • React.Js
  • MySQL
© 2026 KoderSolutionAll Rights Reserved
Developed Bymaksudur.dev
📦

Git

Topic Hub & Articles

Git HOME

10 min

Git Intro

10 min

Git Install

10 min

Git Config

10 min

Git Get Started

10 min

Git New Files

10 min

Git Staging

10 min

Git Commit

10 min

Git Tagging

10 min

Git Stash

10 min

Git History

10 min

Git Help

10 min

Git Branch

10 min

Git Merge

10 min

Git Workflow

10 min

Git Best Practices

10 min

Git Glossary

10 min

GitHub Get Started

10 min

Git What is SSH?

10 min

GitHub Add SSH

10 min

GitHub Set Remote

10 min

GitHub Edit Code

10 min

Pull from GitHub

10 min

Push to GitHub

10 min

GitHub Branch

10 min

Pull Branch from GitHub

10 min

Push Branch to GitHub

10 min

GitHub Flow

10 min

GitHub Pages

10 min

Git GUI Clients

10 min

GitHub Fork

10 min

Git Clone

10 min

GitHub Pull Request

10 min

Git Revert

10 min

Git Reset

10 min

Git Amend

10 min

Git Rebase

10 min

Git Reflog

10 min

Git Recovery

10 min

Git .gitignore

10 min

Git .gitattributes

10 min

Git Large File Storage

10 min

Git Signing

10 min

Git Cherry Pick

10 min

Git Merge Conflicts

10 min

Git CI/CD

10 min

Git Hooks

10 min

Git Submodules

10 min

Git Remote Advanced

10 min

Git Exercises

10 min

Git Quiz

10 min

Git Syllabus

10 min

Git Study Plan

10 min

Progress
0%

0 / 53 Lessons

GitGit Tutorial
Lesson

Git Config

10 min reading
Free Course

Git Config

Git configuration sets global developer identity, default branch names, line-ending handling, and preferred text editor settings.

Core Concepts & Explanation


Now let Git know who you are.

This is important for version control systems, as each Git commit uses this information:

Tip for Beginners: Configuring Git is safe.

You can change these settings at any time, they only affect how your name and email appear in your commits.


User Name

Your name will be attached to your commits. Set it with:

Example
git config --global user.name "Your Name"

Note: If you make a typo or mistake, just run the command again with the correct value.

The new setting will overwrite the old one.


Email Address

Your email is also attached to your commits. Set it with:

Example
git config --global user.email "[email protected]"

Change the user name and email to your own.

You will probably also want to use this when registering to GitHub later on.

Note: If you forget to set your name or email, Git will prompt you the first time you try to commit.

You can always change these settings later, and previous commits will keep the old info.

Use --global to set the value for every repository on your computer.

Use --local (the default) to set it only for the current repository.


Git uses your name and email to label your commits.

If you do not set these, Git will prompt you the first time you try to commit.

Now you have added the minimum of configuration needed to start using Git.

So feel free to continue with the next chapter.

For more information about configuration, or if you want to change anything, keep reading this page.



Viewing Your Configuration

You can see all your Git settings with:

Example: List All Settings
git config --list
user.name=Your Name
[email protected]
core.editor=code --wait
alias.st=status
init.defaultbranch=main
...

To view a specific value, use:

Example: View a Specific Setting
git config user.name
Your Name

Changing or Unsetting Config Values

To change a value, just run the git config command again with the new value.

To remove a setting, use --unset:

Example: Unset an Alias
git config --global --unset code.editor

Default Branch Name

Set the default branch name for new repositories (for example, main instead of master):

Example: Set Default Branch Name
git config --global init.defaultBranch main

Configuration Levels

There are three levels of configuration:

  • System (all users): git config --system
  • Global (current user): git config --global
  • Local (current repo): git config --local

The order of precedence is:

  • Local (current repo)
  • Global (current user)
  • System (all users)

The reason to use the different levels is that you can set different values for different users or repositories.

This can be used for example to set different default branches for different repositories and users.

Example: Set a Local Config
Local settings only apply to the current repository.
git config user.name "Project Name"

Example: Set a Global Config
Global settings apply to all repositories for the current user.
git config --global user.name "Global Name"

Example: Set a System Config
System settings apply to all repositories for all users.
git config --system user.name "System Name"


Practical Terminal Workflow

Execute the following terminal commands to work with this concept in your workspace:

# Set global developer identity
git config --global user.name "Your Name"
git config --global user.email "[email protected]"

# Set default initial branch name to main
git config --global init.defaultBranch main

Best Practices & Pro-Tips

  • Atomic Commits: Keep each commit small, focused, and dedicated to a single logical feature or bug fix.
  • Imperative Commit Messages: Write commit titles in imperative mood (e.g., Fix CORS bug rather than Fixed CORS bug).
  • Review Diff Before Staging: Run git diff to review unstaged modifications before adding files to the index.

Common Gotchas & Troubleshooting

  • Detached HEAD State: Triggered when checking out a specific commit hash directly rather than a branch. Create a new branch with git switch -c <branch-name> to preserve edits.
  • Accidentally Staged Binary Files: Run git restore --staged <filename> to remove the file from the index without altering your local workspace copy.

Self-Check Challenge

Open your terminal in a test project directory, execute git status, and verify your current working tree state. Practice running git log --oneline to review commit history.

Save Your Progress

Unlock Your
Full Potential.

Sign in to track your learning journey, earn industry-recognized certificates, and join our elite developer community.

Quick Access With

Enterprise-Grade Security Protocol

Recommended Courses & Books

Stuck on this lesson?

Join our community of senior developers.

Ask in Forum