0

When I attempt to push my latest code to the master branch on Github using VSCode I get a pop-up error message advising the following:

Can't push refs to remote. Try running 'Pull' first to integrate your changes.

So I try a Pull, but I get a pop-up window advising me:

There is no tracking information for that branch.

Here's the Git log for the Push:

> git push origin master
To https://github.com/WebDevelopWolf/Date-A-Dog.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/WebDevelopWolf/Date-A-Dog.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

And the Git Log for the 'Pull':

> git pull --tags
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

I can see it's asking about merging - however I only have the one branch and that's the original master branch. There is a fair bit of code in there, but the last thing that was committed was a README.md file and I did that from GitHub itself, so I don't know if that makes a difference at all?

Web Develop Wolf
  • 5,996
  • 12
  • 52
  • 101
  • Does this answer your question? [There is no tracking information for the current branch](https://stackoverflow.com/questions/32056324/there-is-no-tracking-information-for-the-current-branch) – phd Mar 15 '20 at 13:45
  • https://stackoverflow.com/search?q=%5Bgit%5D+pull+There+is+no+tracking+information+for+the+current+branch – phd Mar 15 '20 at 13:45

2 Answers2

1

Your local branch is behind the remote branch you care about, so you need to pull those changes (preferably with --rebase in this case).

However, git pull by default pulls from a tracked branch. The branch in question is not tracking anything.

So, follow the error message’s instructions and use git branch --set-upstream..., then git pull, then try git push.

D. Ben Knoble
  • 4,273
  • 1
  • 20
  • 38
0

Do below sequence

  1. Git pull origin master
  2. resolve any merge conflicts if any
  3. git add .
  4. git commit -m "....."
  5. git push
CrazyCoder
  • 153
  • 3
  • 17