Can't push to remote branch, cannot be resolved to branch

前端 未结 18 1392
太阳男子
太阳男子 2020-12-12 19:58

I migrated my repos from Bitbucket or Github. I don\'t think this matters but it\'s the only thing different... For a little while I had two remotes set up:



        
相关标签:
18条回答
  • 2020-12-12 20:20

    Maybe your forgot to run git fetch? it's required to fetch data from the remote repo! Try running git fetch remote/branch

    0 讨论(0)
  • 2020-12-12 20:20

    You might have created similar branch but different case-sensitive-wise, then you have to run:

    git branch -D <name-of-different-case-branch>

    and then try to push again.

    0 讨论(0)
  • 2020-12-12 20:24

    It's case-sensitive, just make sure created branch and push to branch both are in same capital.

    Example:

    git checkout -b "TASK-135-hello-world"
    

    WRONG way of doing:

    git push origin task-135-hello-world     #FATAL: task-135-hello-world cannot be resolved to branch
    

    CORRECT way of doing:

    git push origin TASK-135-hello-world
    
    0 讨论(0)
  • 2020-12-12 20:24

    I just had this issue as well and my normal branches start with pb-3.1-12345/namebranch but I accidental capitalized the first 2 letters PB-3.1/12345/namebranch. After renaming the branch to use lower case letters I could create the branch.

    0 讨论(0)
  • 2020-12-12 20:25

    Git will let you checkout the current branch with a different casing, and it will fail to find a ref on the remote.

    Just found out the hard way.

    0 讨论(0)
  • 2020-12-12 20:25

    A similar thing happened to me. I created a branch called something like "Feat/name". I tried to pushed it using :

    git push --set-upstream origin Feat/name

    I got the same fatal error as you :

    fatal: Feat/name cannot be resolved to branch

    To solve it I created a new branch as I had very few files impacted. Then I listed my branches to delete the wrong one and it displayed with no cap :

    • feat/name

    I had used caps before but never on the first caracter. It looks like git doesn't like it...

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