Configuration of Git
We can configure Git both locally and globally. If we want to set ownership for a single repository, we configure it locally. If we want the ownership settings to apply to all repositories on the system, we configure it globally.
Check if Git is installed
Open your terminal (linux/macOS) or GitBash (Windows):
git --version
if installed, you will see something like :

Configure Git Globally
This sets your identity for all repositories on your system.
git config --global user.name "username"
git config --global user.email "[email protected]"
Warning: If you'll push to GitHub and want to keep your email private, use Github's noreply email (e.g., [email protected])


Configure Git Locally
Step 1 : Create a Repository
Make a directory gitproject
and navigate to folder and initialize the git repo with command git init
.
mkdir gitproject
cd gitproject
git init



if you want to push local repo to GitHub, you can learn from here
Step 2 : Configure the Git locally
We can use
--local
instead of--global
in the configuration to configure the git repo locally.
git config --local user.name "username"
git config --local user.email "[email protected]"

View Git Configuration
If you want to view Global Configuration, use command :
git config --global --list
it will show you configuration details :

If you want to view Local Configuration, navigate the repo folders and run the command :
git config --local --list

Last updated