Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

There is no tracking information for the current branch

I've been using github from a relatively short period, and I've always used the client to perform commits and pulls. I decided to try it from the git bash yesterday, and I successfully created a new repo and committed files.

Today I did changes to the repository from another computer, I've committed the changes and now I'm back home and performed a git pull to update my local version and I get this:

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 develop origin/<branch>

the only contributor to this repo is me and there are no branches (just a master). I'm on windows and I've performed the pull from git bash:

enter image description here

git status:

$ git status
# On branch master
nothing to commit, working directory clean

git branch:

$ git branch
* master

What am I doing wrong?

like image 442
valerio0999 Avatar asked Aug 17 '15 17:08

valerio0999


People also ask

How do I set tracking information for the current 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 develop origin/<branch>

Is there a git pull tracking information for the current branch?

there is no tracking information for the current branch switched branch git pull There is no tracking information for the current branch. Please specify which branch you want to merge with. there is no tracking information for the current branch\ There is no tracking information for the current branch.

Why can't I track my remote account on my current branch?

This happens due to current branch has no tracking on the branch on the remote. so you can do it with 2 ways. Or you can specific branch to track to the local branch. will tell you what needs to be done.

How to fix Git error There is no tracking information?

How to fix Git error: There is no tracking information for the current branch. When performing an operation like git pull, git push, git fetch, etc, without specifying the remote or the branch involved in the operation, you should first make sure that the current branch has a corresponding upstream.


4 Answers

You could specify what branch you want to pull:

git pull origin master

Or you could set it up so that your local master branch tracks github master branch as an upstream:

git branch --set-upstream-to=origin/master master
git pull

This branch tracking is set up for you automatically when you clone a repository (for the default branch only), but if you add a remote to an existing repository you have to set up the tracking yourself. Thankfully, the advice given by git makes that pretty easy to remember how to do.

like image 78
ComputerDruid Avatar answered Oct 15 '22 16:10

ComputerDruid


See: git checkout tag, git pull fails in branch

If like me you need to do this all the time, you can set up an alias to do it automatically by adding the following to your .gitconfig file:

[alias]
    set-upstream = \
       !git branch \
           --set-upstream-to=origin/`git symbolic-ref --short HEAD`

When you see the message There is no tracking information..., run:

 git set-upstream
 git push

Thanks to https://zarino.co.uk/post/git-set-upstream/

like image 25
rjmunro Avatar answered Oct 15 '22 17:10

rjmunro


ComputerDruid's answer is great but I don't think it's necessary to set upstream manually unless you want to. I'm adding this answer because people might think that that's a necessary step.

This error will be gone if you specify the remote that you want to pull like below:

git pull origin master

Note that origin is the name of the remote and master is the branch name.


1) How to check remote's name

git remote -v

2) How to see what branches available in the repository.

git branch -r
like image 26
aerin Avatar answered Oct 15 '22 17:10

aerin


Step 1

$ git pull
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=<remote>/<branch> master

Step 2

$ git branch -u origin/master
Branch 'master' set up to track remote branch 'master' from 'origin'.

Step 3

$ git pull
Already up to date.
like image 29
Coconut Avatar answered Oct 15 '22 16:10

Coconut