Git Configuration Setup and Authentication Guide

Git Configuration Levels

Git uses a hierarchical configuration system with three levels: system-wide, global (user-level), and local (repository-level). Each subsequent level overrides the previous one. When viewing all configurations, they display in order from lowest to highest priority.

View all configuration settings:

git config --list

Check system-level configuration. On Windows, the system configuration file is located at Git\Installation\Directory\etc\gitconfig.

git config --system --list

Check global user-level configuration. On Windows, this file resides at C:\Users\Username\.gitconfig.

git config --global --list

Check repository-specific configuration. On Windows, the file is at ProjectName\.git\config.

git config --local --list

User Identity Configuration

The username and email configured in Git identify the author of each commit. These details are embedded in every commit and appear throughout the project history. Git does not mandate that these credentials match your GitHub or other hosting platform accounts, but maintaining consistency helps attribute your contributions correctly on remote platforms.

git config --global user.name "Developer Name"
git config --global user.email "dev@example.com"

Set the default branch name for new repositories:

git config --global init.defaultBranch main

Rename the current brench:

git branch -m new-branch-name

Create a bare repository (no working directory). Bare repositories store only vertion control metadata without checked-out files, making them suitable as central repositories for push and pull operations.

git init --bare

Authentication Configuration

Store credentials for HTTP/HTTPS operations:

git config --global credential.helper store

This configures Git to remember your username and password for HTTP requests. Upon your first authenticated operation like git push or git pull, enter your credentials once. Git saves them to ~/.git-credentials and automatically reuses them for subsequent operations.

For SSH-based authentication, generate an SSH key pair:

ssh-keygen -t rsa -b 4096 -C "workstation-label"

The -C flag adds a comment to identify the key (typically referencing the machine). Upload the public key to your Git hosting provider (GitHub, GitLab, Bitbucket, etc.). You can register multiple public keys for different machines. Store the private key locally in your SSH agent (default location), and Git automatically authenticates with remote repositories via SSH without prompting for passwords.

To add your key to the SSH agent:

ssh-add ~/.ssh/id_rsa

Tags: Git Version Control configuration ssh Authentication

Posted on Tue, 07 Jul 2026 16:30:18 +0000 by tjohnson_nb