Git 2.0
Software Warning
Code Repository
Configuration Settings
Software Development

Warning push.default is unset; its implicit value is changing in Git 2.0

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

Introduction

The warning push.default is unset; its implicit value is changing in Git 2.0 appears when you run git push without specifying a branch and without having configured the push.default setting. In Git 1.x, the default push behavior was matching — pushing all local branches that have a same-named remote branch. In Git 2.0, this changed to simple — pushing only the current branch and only if it has the same name upstream. The fix is to set push.default explicitly with git config --global push.default simple.

The Warning Message

 
1warning: push.default is unset; its implicit value has changed in
2Git 2.0 from 'matching' to 'simple'. To squelch this message
3and maintain the traditional behavior, use:
4
5  git config --global push.default matching
6
7To squelch this message and adopt the new behavior now, use:
8
9  git config --global push.default simple
10
11When push.default is set to 'matching', git will push local branches
12to the remote branches that already exist with the same name.
13
14Since Git 2.0, Git defaults to the more conservative 'simple'
15behavior, which only pushes the current branch to the corresponding
16remote branch that 'git pull' would pull from.

Fixing the Warning

bash
1# Recommended: use 'simple' (Git 2.0+ default)
2git config --global push.default simple
3
4# Verify the setting
5git config --global push.default
6# simple

This sets the configuration in your global ~/.gitconfig file and silences the warning permanently.

All push.default Options

bash
# View all options
git help config
OptionBehaviorWhen to Use
simplePush current branch to its upstream branch, only if names matchDefault since Git 2.0 — safest for most users
currentPush current branch to a same-named branch on the remoteWhen you want auto-push without upstream tracking
upstreamPush current branch to its upstream branch (any name)When local and remote branch names differ
matchingPush all branches that have same-named remote branchesLegacy Git 1.x behavior — pushes multiple branches
nothingPush nothing unless a refspec is givenMaximum safety — always specify the branch

Differences in Practice

bash
1# With push.default = simple
2git checkout feature-x
3git push
4# Pushes feature-x → origin/feature-x (only if upstream is set and names match)
5
6# With push.default = current
7git checkout feature-x
8git push
9# Pushes feature-x → origin/feature-x (creates remote branch if needed)
10
11# With push.default = matching
12git checkout feature-x
13git push
14# Pushes ALL branches: main → origin/main, feature-x → origin/feature-x, etc.
15
16# With push.default = upstream
17git checkout local-name
18git push
19# Pushes local-name → origin/different-remote-name (follows tracking config)

Setting Up Upstream Tracking

simple requires an upstream branch to be set. If you see fatal: The current branch has no upstream branch:

bash
1# Set upstream when pushing a new branch
2git push -u origin feature-x
3# -u is shorthand for --set-upstream
4
5# Or set upstream without pushing
6git branch --set-upstream-to=origin/feature-x
7
8# Check current upstream
9git branch -vv
10# * feature-x abc1234 [origin/feature-x] Latest commit message

After the first git push -u, subsequent git push commands work without arguments.

Checking Your Current Configuration

bash
1# Check push.default specifically
2git config push.default
3
4# Check all push-related settings
5git config --list | grep push
6
7# Check where the setting is defined
8git config --show-origin push.default
9# file:/Users/you/.gitconfig    simple
10
11# Check effective config (local overrides global)
12git config --local push.default   # Repository-level
13git config --global push.default  # User-level
14git config --system push.default  # System-level

Configuration Levels

bash
1# System level (all users)
2git config --system push.default simple
3# Stored in /etc/gitconfig
4
5# Global level (current user)
6git config --global push.default simple
7# Stored in ~/.gitconfig
8
9# Local level (current repository only)
10git config --local push.default current
11# Stored in .git/config
12
13# Priority: local > global > system

Common Pitfalls

  • Ignoring the warning and using Git 1.x matching behavior unknowingly: With matching, running git push on any branch pushes all branches with matching remote names. You may accidentally push unfinished work from other branches. Setting simple explicitly prevents this.
  • Confusing simple with current: simple requires an upstream branch to be set and checks that local and remote names match. current creates a remote branch with the same name if one does not exist, without requiring upstream tracking. For most workflows, simple is safer.
  • Not setting --global and wondering why the warning returns: git config push.default simple (without --global) sets the configuration only for the current repository. The warning reappears in other repositories. Use --global for a user-wide setting.
  • Using matching in shared repository workflows: In a team environment, matching can push branches that are not ready for review. This is especially dangerous if you have local branches tracking shared remote branches. Use simple or current instead.
  • Forgetting to set upstream with git push -u: When using simple, the first push of a new branch requires -u (or --set-upstream) to establish tracking. Without it, git push fails with "no upstream branch." Run git push -u origin branch-name once to set it up.

Summary

  • Set git config --global push.default simple to silence the warning and use the Git 2.0+ default
  • simple pushes only the current branch to its tracking upstream — the safest option for most users
  • matching (Git 1.x default) pushes all branches with matching remote names — risky in team environments
  • Use git push -u origin branch-name to set upstream tracking for new branches
  • Use current if you want Git to automatically create remote branches without setting upstream first
  • The setting can be overridden per-repository with git config --local push.default

Related reading
Free course
Beginner
7 lessons
2 hours
Tackling System Design Interview Problems

A short course that equips you with the skills to approach system design interviews methodically.

Start the free course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

All Rights Reserved.