Resolve the Git error “There is no tracking information for the current branch”

You may encounter the following Git error, which indicates that the current branch is not linked to a remote branch.

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> master

Solution 1: Set tracking information

To link your local branch to a remote branch, use the following command:

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

Replace <branch> with the name of the remote branch you want to track, for example, main or develop.

Solution 2: Make an initial commit

If you’re working in a new repository and encounter this error when trying to push, it may be because the repository is empty. To fix this, make an initial empty commit and push it to the remote repository:

git commit --allow-empty -m "initial"

git push

This creates the initial commit and allows Git to establish tracking information for the branch.

Tip

Use git status to confirm your branch is tracking a remote branch.