0
0
Gitdevops~15 mins

Global vs local configuration in Git - Hands-On Comparison

Choose your learning style9 modes available
Understanding Git Global vs Local Configuration
📖 Scenario: You are setting up Git on your computer to manage your projects. Git allows you to set configuration options either globally (for all projects) or locally (for a specific project).Understanding the difference helps you control your identity and preferences in different projects.
🎯 Goal: You will learn how to set and view Git configuration settings globally and locally, and understand which settings apply in each case.
📋 What You'll Learn
Use git config --global to set global configuration
Use git config --local to set local configuration
Use git config --list --global to view global settings
Use git config --list --local to view local settings
Understand the difference between global and local Git configuration
💡 Why This Matters
🌍 Real World
Developers often use global Git settings for their name and email to identify themselves in commits across all projects. Local settings allow customizing identity or preferences per project, such as when working on shared or company projects.
💼 Career
Understanding Git configuration is essential for software developers, DevOps engineers, and anyone collaborating on code. It helps maintain clear commit history and project-specific settings.
Progress0 / 4 steps
1
Set your global Git user name
Use the command git config --global user.name "Alice Global" to set your global Git user name.
Git
Need a hint?

Global configuration applies to all Git projects on your computer.

2
Set your local Git user name for a project
Use the command git config --local user.name "Alice Local" to set your local Git user name inside the current Git project folder.
Git
Need a hint?

Local configuration overrides global settings for this project only.

3
View your global Git configuration
Use the command git config --list --global to display all global Git configuration settings.
Git
Need a hint?

This shows the global settings you set earlier.

4
View your local Git configuration
Use the command git config --list --local to display all local Git configuration settings for the current project.
Git
Need a hint?

This shows the local settings which override global ones in this project.