Git 2 reference · Basics

git config Command (Git)

Read and set Git settings per repository, per user (--global) or system-wide, such as your name, email and aliases.

Git 2

Create a free account to save this page, take notes and track your progress. Sign in

Syntax

git config [--global|--local] KEY [VALUE]   git config --list

Parameters

ParameterDescription
--global Settings for your user (~/.gitconfig).
user.name / user.email Identity recorded in commits.
alias.NAME Shortcut commands.
--list --show-origin Show settings and where they come from.

Examples

Set up identity, defaults and an alias
git config --global user.name 'Ana Dev'
git config --global init.defaultBranch main
git config --global alias.lg 'log --oneline --graph'
git config --global --list

Output

user.name=Ana Dev
init.defaultbranch=main
alias.lg=log --oneline --graph

Run this on your computer — see “Get Started” for setup.

A repository-level setting
git init -q -b main app && cd app
echo '# Shop' > README.md
git add README.md && git commit -q -m 'Initial commit'
git config --local pull.rebase true
git config --get pull.rebase

Output

true

Run this on your computer — see “Get Started” for setup.

Was this page helpful?