There is no tracking information for the current branch

后端 未结 13 2566
无人及你
无人及你 2020-11-27 23:59

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

相关标签:
13条回答
  • 2020-11-28 00:44

    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/

    0 讨论(0)
  • 2020-11-28 00:45

    try

       git pull --rebase
    

    hope this answer helps originally answered here https://stackoverflow.com/a/55015370/8253662

    0 讨论(0)
  • 2020-11-28 00:46

    The same thing happened to me before when I created a new git branch while not pushing it to origin.

    Try to execute those two lines first:

    git checkout -b name_of_new_branch # create the new branch
    git push origin name_of_new_branch # push the branch to github
    

    Then:

    git pull origin name_of_new_branch
    

    It should be fine now!

    0 讨论(0)
  • 2020-11-28 00:47

    Try using

    git push --set-upstream origin <branch_name>
    

    Otherwise

    use

    git push -u 
    

    will tell you what needs to be done.

    0 讨论(0)
  • 2020-11-28 00:50

    I was trying the above examples and couldn't get them to sync with a (non-master) branch I had created on a different computer. For background, I created this repository on computer A (git v 1.8) and then cloned the repository onto computer B (git 2.14). I made all my changes on comp B, but when I tried to pull the changes onto computer A I was unable to do so, getting the same above error. Similar to the above solutions, I had to do:

    git branch --set-upstream-to=origin/<my_repository_name> 
    git pull
    

    slightly different but hopefully helps someone

    0 讨论(0)
  • 2020-11-28 00:52

    I run into this exact message often because I create a local branches via git checkout -b <feature-branch-name> without first creating the remote branch.

    After all the work was finished and committed locally the fix was git push -u which created the remote branch, pushed all my work, and then the merge-request URL.

    0 讨论(0)
提交回复
热议问题