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.
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
Fixing the Warning
This sets the configuration in your global ~/.gitconfig file and silences the warning permanently.
All push.default Options
| Option | Behavior | When to Use |
simple | Push current branch to its upstream branch, only if names match | Default since Git 2.0 — safest for most users |
current | Push current branch to a same-named branch on the remote | When you want auto-push without upstream tracking |
upstream | Push current branch to its upstream branch (any name) | When local and remote branch names differ |
matching | Push all branches that have same-named remote branches | Legacy Git 1.x behavior — pushes multiple branches |
nothing | Push nothing unless a refspec is given | Maximum safety — always specify the branch |
Differences in Practice
Setting Up Upstream Tracking
simple requires an upstream branch to be set. If you see fatal: The current branch has no upstream branch:
After the first git push -u, subsequent git push commands work without arguments.
Checking Your Current Configuration
Configuration Levels
Common Pitfalls
- Ignoring the warning and using Git 1.x
matchingbehavior unknowingly: Withmatching, runninggit pushon any branch pushes all branches with matching remote names. You may accidentally push unfinished work from other branches. Settingsimpleexplicitly prevents this. - Confusing
simplewithcurrent:simplerequires an upstream branch to be set and checks that local and remote names match.currentcreates a remote branch with the same name if one does not exist, without requiring upstream tracking. For most workflows,simpleis safer. - Not setting
--globaland 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--globalfor a user-wide setting. - Using
matchingin shared repository workflows: In a team environment,matchingcan push branches that are not ready for review. This is especially dangerous if you have local branches tracking shared remote branches. Usesimpleorcurrentinstead. - Forgetting to set upstream with
git push -u: When usingsimple, the first push of a new branch requires-u(or--set-upstream) to establish tracking. Without it,git pushfails with "no upstream branch." Rungit push -u origin branch-nameonce to set it up.
Summary
- Set
git config --global push.default simpleto silence the warning and use the Git 2.0+ default simplepushes only the current branch to its tracking upstream — the safest option for most usersmatching(Git 1.x default) pushes all branches with matching remote names — risky in team environments- Use
git push -u origin branch-nameto set upstream tracking for new branches - Use
currentif 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
- Warning push.default is unset; its implicit value is changing in Git 2.0
- What actions does job.commit perform in aws glue?
- What are Insertions Deletions in Git?
- What are some examples of commonly used practices for naming git branches?
- What are some examples of commonly used practices for naming git branches?
- What are the advantages of a rebase over a merge in git?
- What are the differences between double-dot .. and triple-dot ... in Git commit ranges?
- What are the differences between git branch, fork, fetch, merge, rebase and clone?
.png&w=3840&q=75)
Tackling System Design Interview Problems
A short course that equips you with the skills to approach system design interviews methodically.
Start the free courseTrack 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.