ProjectStack
git

fatal: The current branch has no upstream branch

Your local branch isn't linked to any remote branch. Git doesn't know where to push or pull, so you need to set the upstream tracking relationship.

Common causes

  • You created a new local branch but never pushed it to the remote
  • The upstream tracking was removed or never set
  • You renamed the branch locally but the remote branch still has the old name
  • You're pushing for the first time on this branch

How to fix it

  1. Push and set the upstream at the same time: git push -u origin <branch-name>
  2. Set the upstream without pushing: git branch --set-upstream-to=origin/<branch-name>
  3. Check current tracking info: git branch -vv
  4. After setting upstream, plain git push and git pull will work normally

Example

fatal: The current branch feature/auth has no upstream branch. To push the current branch and set the remote as upstream, use: git push --set-upstream origin feature/auth

Running git push on a newly created local branch for the first time

Have a different error?

Paste any error message into the Error Translator to get an instant explanation.