Claude
Skills
Sign in
Back

git-config

Included with Lifetime
$97 forever

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.

Code Review

What this skill does


# Git Configuration

Comprehensive guidance for configuring Git beyond basic installation. This skill covers global configuration, performance optimization, aliases, credential management, maintenance, and advanced configuration topics.

## Table of Contents

- [Overview](#overview)
- [When to Use](#when-to-use-this-skill)
- [Quick Start](#quick-start)
- [Configuration Files](#configuration-file-locations)
- [Global Settings](#global-configuration-settings)
- [Rerere](#managing-rerere-reuse-recorded-resolution)
- [Line Endings](#line-ending-strategy-defense-in-depth)
- [Aliases](#aliases)
- [Clone Shortcuts](#clone-shortcuts)
- [Repository-Level Config](#repository-level-configuration)
- [Maintenance](#maintenance)
- [Git Attributes](#git-attributes)
- [Credentials](#git-credential-management)
- [Troubleshooting](#troubleshooting)
- [Test Scenarios](#test-scenarios)

## Overview

This skill helps you:

- Configure Git globally for optimal performance and workflow
- Set up powerful aliases to streamline common operations
- Manage Git credentials securely (GitHub CLI, Windows Credential Manager)
- Configure `.gitattributes` for line ending control
- Enable Git maintenance for better repository performance
- Understand repository-level vs global configuration
- Troubleshoot common configuration issues

**For basic Git installation and setup**, see the **setup** skill.

## Example Use Cases

This skill activates for questions like:

- "How do I set up Git aliases for common operations?"
- "Configure Git to use GitHub CLI for authentication"
- "My Git is slow on large repos - how can I optimize performance?"
- "Set up .gitattributes for cross-platform development"
- "Enable Git background maintenance"
- "Troubleshoot 'refusing to allow OAuth App to create workflow' error"
- "Configure Git credential helpers on Windows"
- "Set up clone shortcuts for frequently-used repositories"
- "Configure rerere to remember merge conflict resolutions"

## When to Use This Skill

Use this skill when:

- Configuring Git beyond basic user identity
- Setting up aliases for common Git operations
- Optimizing Git performance (fsmonitor, untrackedCache, parallel operations)
- Managing Git credentials (HTTPS, SSH, token scopes)
- Setting up GitHub CLI as credential helper
- Configuring `.gitattributes` for cross-platform line ending control
- Enabling Git background maintenance
- Setting up clone shortcuts for frequently-used repositories
- Troubleshooting credential issues or line ending errors
- Understanding Git configuration hierarchy (system/global/local)

## Quick Start

**Most impactful configuration settings to apply immediately:**

```bash
# 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
```

---

## Quick Reference

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](references/quick-reference.md)

The quick reference table provides copy-paste commands for all common settings with category organization and purpose explanations.

---

## Configuration File Locations

For detailed information about Git configuration file locations, hierarchy, and viewing configuration, see [references/configuration-basics.md](references/configuration-basics.md).

**Quick summary:**

- **System**: `/etc/gitconfig` (or Git install dir on Windows) - All users
- **Global**: `~/.gitconfig` or `~/.config/git/config` - Current user
- **Local**: `.git/config` - Single repository only
- **Priority**: Local > Global > System

**View configuration:**

```bash
# View all configuration with source files
git config --list --show-origin

# View specific value
git config user.name
```

---

## Global Configuration Settings

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):**

```bash
# 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](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.

---

## Managing rerere (Reuse Recorded Resolution)

Git's rerere feature remembers how you resolved merge conflicts and can reapply those resolutions automatically.

**Enable rerere:**

```bash
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](references/configuration-basics.md#managing-rerere-reuse-recorded-resolution)

## Line Ending Strategy (Defense in Depth)

**Cross-platform line ending management uses a layered approach:**

1. **System level (autocrlf)**: Platform-specific default (Windows: `true`, macOS/Linux: `input`)
2. **Global level (safecrlf)**: Warns about MIXED endings (actual problems) but allows legitimate conversions
3. **Repository level (.gitattributes)**: Explicit control per file type

**Defense in depth:** These settings are **complementary, not conflicting**:

- `autocrlf` handles the conversion automatically
- `safecrlf=warn` warns about PROBLEMS (mixed line endings) but doesn't block .gitattributes conversions
- `.gitattributes` provides per-repo fine-grained control

**Important:** Don't use `safecrlf=true` when you have `.gitattributes` - it will block legitimate conversions and cause constant errors!

**Platform-specific autocrlf settings:**

- **Windows**: `git config --global core.autocrlf true` (converts LF→CRLF on checkout, CRLF→LF on commit)
- **macOS/Linux**: `git config --global core.autocrlf input` (converts CRLF→LF on commit, no conversion on checkout)
- **WSL**: `git config --global core.autocrlf input` (same as Linux)

**Global safecrlf setting (all platforms):**

```bash
# 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

Related in Code Review