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
Syntax
git config [--global|--local] KEY [VALUE] git config --list
Parameters
| Parameter | Description |
|---|---|
--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
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.
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.
Related
git init· Create a new Git repository in a directory, optionally naming the first branch, ready for the first commit.- Setting Up Git and Creating a Repository · tutorial