Comprehensive Git configuration guide covering global settings, aliases, performance tuning, credential management, maintenance, .gitattributes, clone shortcuts, and troubleshooting. Use when configuring Git beyond basic setup, optimizing Git performance, setting up aliases, managing credentials (GitHub CLI, Windows Credential Manager), configuring line ending strategy, setting up .gitattributes, enabling Git maintenance, or troubleshooting configuration issues. Cross-platform guidance for Windows, macOS, and Linux.
Limited to specific tools
Additional assets for this skill
This skill is limited to using the following tools:
references/aliases.mdreferences/configuration-basics.mdreferences/credential-management.mdreferences/global-configuration.mdreferences/quick-reference.mdreferences/test-scenarios.mdreferences/troubleshooting.mdComprehensive guidance for configuring Git beyond basic installation. This skill covers global configuration, performance optimization, aliases, credential management, maintenance, and advanced configuration topics.
This skill helps you:
.gitattributes for line ending controlFor basic Git installation and setup, see the setup skill.
This skill activates for questions like:
Use this skill when:
.gitattributes for cross-platform line ending controlMost impactful configuration settings to apply immediately:
# Performance improvements
git config --global core.fsmonitor true
git config --global core.untrackedCache true
git config --global fetch.parallel 8
git config --global checkout.workers 8
# Better pull/rebase workflow
git config --global pull.rebase true
git config --global rebase.autoStash true
git config --global rebase.updateRefs true
# Auto-prune deleted remote branches
git config --global fetch.prune true
git config --global fetch.pruneTags true
# Better merge conflict resolution
git config --global merge.conflictstyle zdiff3
# Auto-setup remote tracking on first push
git config --global push.autoSetupRemote true
# Better diff algorithm
git config --global diff.algorithm histogram
git config --global diff.colorMoved zebra
# Line ending safety check
git config --global core.safecrlf warn
Common Git configuration settings organized by category for quick lookup (performance, pull/rebase, fetch, push, diff, merge, line endings, sorting, maintenance).
📚 Complete Quick Reference Table: references/quick-reference.md
The quick reference table provides copy-paste commands for all common settings with category organization and purpose explanations.
For detailed information about Git configuration file locations, hierarchy, and viewing configuration, see references/configuration-basics.md.
Quick summary:
/etc/gitconfig (or Git install dir on Windows) - All users~/.gitconfig or ~/.config/git/config - Current user.git/config - Single repository onlyView configuration:
# View all configuration with source files
git config --list --show-origin
# View specific value
git config user.name
These settings are cross-platform and recommended for all users. They should be set at the global level unless you need repository-specific overrides.
Most Essential Settings (Quick Start):
# Pull & rebase (cleaner history)
git config --global pull.rebase true
git config --global rebase.autoStash true
# Fetch (auto-prune deleted branches/tags)
git config --global fetch.prune true
git config --global fetch.pruneTags true
git config --global fetch.parallel 8
# Push (auto-setup remote tracking)
git config --global push.autoSetupRemote true
# Diff & merge (better algorithms and conflict display)
git config --global diff.algorithm histogram
git config --global diff.colorMoved zebra
git config --global merge.conflictstyle zdiff3
# Performance (filesystem monitoring)
git config --global core.fsmonitor true
git config --global core.untrackedCache true
# Sorting (newest first)
git config --global branch.sort -committerdate
git config --global tag.sort -taggerdate
📚 Complete Global Configuration Guide: references/global-configuration.md
Topics covered: Pull & rebase strategy, fetch strategy, push strategy, checkout/switch strategy, commit settings, status settings, diff settings, merge settings, rerere (conflict resolution memory), color settings, sorting, log settings, performance settings, submodule strategy, miscellaneous settings, and advanced configuration options.
Git's rerere feature remembers how you resolved merge conflicts and can reapply those resolutions automatically.
Enable rerere:
git config --global rerere.enabled true
git config --global rerere.autoUpdate true
For detailed information about how rerere works, safety considerations, and management commands, see references/configuration-basics.md
Cross-platform line ending management uses a layered approach:
true, macOS/Linux: input)Defense in depth: These settings are complementary, not conflicting:
autocrlf handles the conversion automaticallysafecrlf=warn warns about PROBLEMS (mixed line endings) but doesn't block .gitattributes conversions.gitattributes provides per-repo fine-grained controlImportant: Don't use safecrlf=true when you have .gitattributes - it will block legitimate conversions and cause constant errors!
Platform-specific autocrlf settings:
git config --global core.autocrlf true (converts LF→CRLF on checkout, CRLF→LF on commit)git config --global core.autocrlf input (converts CRLF→LF on commit, no conversion on checkout)git config --global core.autocrlf input (same as Linux)Global safecrlf setting (all platforms):
# Warn about mixed line endings (safeguard against problems)
# Use 'warn' not 'true' - allows .gitattributes to work without constant errors
git config --global core.safecrlf warn
For detailed .gitattributes setup and comprehensive line ending guidance, see the line-endings skill.
Aliases provide shortcuts for common Git operations. Categories include: information & inspection, navigation, branch operations, staging/unstaging, committing, history editing, remote operations, and tag pushing workflows.
Most Common Aliases:
# Status and branch info
git config --global alias.st "status -sb"
git config --global alias.br "branch -vv"
# Modern branch switching
git config --global alias.co "switch"
git config --global alias.cob "switch -c"
# Quick amend
git config --global alias.amend "commit --amend --no-edit"
# Safe force push
git config --global alias.pfwl "push --force-with-lease"
📚 Complete Alias Guide: references/aliases.md
Topics covered: Information & inspection aliases, navigation utilities, branch operations, staging/unstaging shortcuts, committing helpers, history editing (DANGER!), remote operations, tag pushing workflows, clone shortcuts with url.insteadOf, organization/personal shorthand patterns, and customization templates.
Git's url.insteadOf feature creates shorthand prefixes for clone URLs. Example: git clone gh:username/repo instead of git clone git@github.com:username/repo.git.
Quick Example:
# Universal GitHub shorthand
git config --global url."git@github.com:".insteadOf "gh:"
# Usage: git clone gh:microsoft/vscode
📚 Complete Clone Shortcuts Guide: references/aliases.md#clone-shortcuts
Topics covered: Universal GitHub shorthand, organization/personal shortcuts, corporate Git servers, custom namespace templates, and usage examples.
These settings are context-specific - use them in individual repos when needed, NOT as global defaults.
When to use repo-level config:
Examples:
# Enable submodule recursion in a specific repo
git config submodule.recurse true
# Disable ahead/behind in a massive repo (performance)
git config status.aheadBehind false
# Override line ending strategy (with .gitattributes)
git config core.autocrlf false
Git can perform background maintenance to keep repositories fast (commit-graph updates, incremental repacking, loose object cleanup).
Quick Setup:
# Enable background maintenance once for your account
git maintenance start
# Register each active repo for maintenance
git maintenance register
# Enable commit-graph generation globally
git config --global gc.writeCommitGraph true
Common Commands:
# Run maintenance now
git maintenance run
# See which repos are registered
git config --global --get-all maintenance.repo
# Unregister a repo
git maintenance unregister
📚 Complete Maintenance Guide: references/global-configuration.md#maintenance
Topics covered: Background maintenance tasks, scheduling (hourly/daily/weekly), task configuration, disabling full gc, maintenance.auto setting, per-task enablement, troubleshooting maintenance issues.
.gitattributes provides explicit control over line endings per file type. This is the recommended approach for cross-platform teams.
Best practice: Control endings in .gitattributes and use platform-appropriate autocrlf settings with safecrlf=warn.
Quick Example:
# Auto-detect text files and normalize line endings
* text=auto
# Force LF for scripts/config (shell and CI tools expect LF)
*.sh text eol=lf
*.yml text eol=lf
*.json text eol=lf
# Force CRLF for Windows-specific files
*.ps1 text eol=crlf
*.cmd text eol=crlf
*.bat text eol=crlf
# Mark binaries
*.png binary
*.jpg binary
*.pdf binary
Normalize existing repos with mixed endings:
git add --renormalize .
git commit -m "Normalize line endings"
📚 For comprehensive .gitattributes setup, Git LFS patterns, and line ending strategy, see the line-endings skill.
Git uses credential helpers to store and retrieve authentication credentials for remote operations (clone, fetch, push). Understanding credential management is essential for secure, efficient Git workflows.
For comprehensive credential management guidance, see references/credential-management.md.
Quick overview:
manager)osxkeychain)cache) or libsecret for persistent storageQuick setup for GitHub (hybrid approach):
# 1. Authenticate with gh CLI
gh auth login --scopes "repo,read:org,workflow" --git-protocol https
# 2. Configure gh CLI as credential helper for GitHub only
gh auth setup-git
# 3. Verify hybrid setup
git config --list | grep credential
# Should show:
# - credential.helper=manager (or osxkeychain/cache - OS default)
# - credential.https://github.com.helper=!gh auth git-credential (GitHub-specific)
Common credential issues:
workflow scopegit remote -vFor detailed troubleshooting, credential helper options, security best practices, and platform-specific guidance, see references/credential-management.md.
For comprehensive troubleshooting guidance, see references/troubleshooting.md.
Quick links:
.gitattributes, Git LFSFor test scenarios validating skill activation and response quality, see references/test-scenarios.md.
Coverage: 9 scenarios covering basic use (aliases, performance, maintenance), advanced use (credentials, line endings, repo config), troubleshooting (credential issues, rerere), and shortcuts (clone shortcuts, url.insteadOf).
Date: 2025-11-28 Model: claude-opus-4-5-20251101