How to set up remote branch tracking automatically in Git

July 01, 2022

Do you often get this message when you try to push your changes to the remote repository?

There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream-to=origin/<branch> mybranch

There is a simple solution to this problem. You can set up the remote branch to track the local branch automatically by running the following command:

git config --global --add --bool push.autoSetupRemote true

Implement