Skip to content
Tutorials Center
My learning

Topics

Git Reference ยท Configuration Options

push.default and push.autoSetupRemote settings

Reference for push.default, push.autoSetupRemote, push.followTags and push.useForceIfIncludes: decide what a bare git push sends and how upstreams are set.

When you run git push with no arguments, Git must decide which branches to send and where. push.default answers the "which branches" question, and push.autoSetupRemote removes the need for -u on the first push of a new branch.

The default value, simple, is deliberately cautious: it pushes the current branch to a branch of the same name on its upstream and refuses when the names differ.

Terminal
git config --global push.default simple
git config --global push.autoSetupRemote true
git config --global push.followTags true

Try it

Bash simple, current and nothing

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.

Bash autoSetupRemote and followTags

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.

Syntax

Terminal
git config push.default (nothing | current | upstream | tracking | simple | matching)
git config push.autoSetupRemote (true | false)
git config push.followTags (true | false)
git config push.useForceIfIncludes (true | false)
git config push.gpgSign (true | false | if-asked)
git config push.recurseSubmodules (check | on-demand | only | no)
Name Description
push.default = simple Default. Push the current branch to the same-named branch on its upstream; refuse if the names differ or no upstream exists (triangular setups use the same name).
push.default = current Push the current branch to a branch of the same name, creating it if needed.
push.default = upstream Push to the configured upstream branch, whatever its name (tracking is the old name).
push.default = matching Push every local branch that has a same-named branch on the remote. Legacy; risky.
push.default = nothing Refuse to push without an explicit refspec.
push.autoSetupRemote When the branch has no upstream, a plain git push behaves like git push -u origin <branch> (Git 2.37+).
push.followTags Also push annotated tags that point at commits being pushed.
push.useForceIfIncludes Makes --force-with-lease stricter by checking that you integrated the remote tip first.
push.gpgSign Sign pushes (needs server support).

Errors: a new branch without an upstream fails with fatal: The current branch topic has no upstream branch. and a hint showing git push --set-upstream. With simple, a differently named upstream fails with a message explaining that names do not match.

Usage notes

  • Which remote? push.default only picks branches. The remote comes from branch.<name>.pushRemote, then remote.pushDefault, then the branch's remote, then origin.
  • autoSetupRemote is the quality-of-life setting for topic-branch workflows: the first push creates the upstream, so git status and later pulls work immediately.
  • Avoid matching. It dates from Git 1.x and can publish half-finished branches; simple replaced it as the default in Git 2.0.
  • followTags skips lightweight tags, as the demo shows; push those explicitly with git push origin <tag>.
  • Force pushes are not controlled here: use --force-with-lease, and see the git push page for details.
  • Explicit refspecs ignore push.default. git push origin main always sends exactly what you named.
  • Mirrors: remote.<name>.push refspecs, if set, also take precedence over push.default.