Git Cheatsheet - Quick Git Command Reference

Quick reference for common Git commands. Search, copy, and use Git commands instantly.

Share
Back to Git Cheatsheet

git config

Get and set repository or global options

Syntax

git config [options] [<name>] [<value>]

Common Options

OptionDescription
--globalUse global config file
--localUse local repository config
--systemUse system-wide config file
--listList all config entries
--get <name>Get specific config value
--unset <name>Remove specific config
--editOpen config file in editor
--add <name> <value>Add multi-value config

Examples

git config --list

List all configs

git config --global user.name "John Doe"

Set global username

git config --global user.email "john@example.com"

Set global email

git config --global alias.co checkout

Set command alias

git config --global init.defaultBranch main

Set default branch name

Related Tools

More Code & Dev Tools