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.

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.

creating a gitproject folder
Change the working directory to gitproject
Initialize the git hub repo

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.

View Git Configuration

  • If you want to view Global Configuration, use command :

it will show you configuration details :

  • If you want to view Local Configuration, navigate the repo folders and run the command :

Last updated