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

前端 未结 18 1393
太阳男子
太阳男子 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:26

    Had the same problem with different casing.

    Did a checkout to development (or master) then changed the name (the wrong name) to something else like test.

    • git checkout development
    • git branch -m wrong-name test

    then change the name back to the right name

    • git branch -m test right-name

    then checkout to the right-name branch

    • git checkout right-name

    then it worked to push to the remote branch

    • git push origin right-name
    0 讨论(0)
  • 2020-12-12 20:28

    I was having this issue as well, and it was driving me crazy. I had something like feature/name but git branch -a showed me FEATURE/name. Renaming the branch, deleting and recreating it, nothing worked. What finally fixed it:

    Go into .git/refs/heads

    You'll see a FEATURE folder. Rename it to feature.

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

    for me I was naming branch as

    Rel4.6/bug/Some-short-description

    all I had to do is when using

    git push origin Relx.x/bug/Some-short-description

    to write

    git push origin relx.x/bug/Some-short-description

    as I used to create branches using small letter r in rel.

    so, what caused this issue?

    when I listed .git/refs/heads content I found

    drwxr-xr-x  4 eslam_khoga  staff   128B Sep 22 20:22 relx.x
    

    but no Relx.x!

    and inside it bug and inside bug my branch's name.

    So, git try to create a dir with same name but different case letters

    but system is not case sensitive.

    That's what caused this issue!

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

    If you are in local branch, could rename the branch "Feature/Name" to "feature/Name"

    git -m feature/Name

    if you have problems to make a git push make a checkout in other branch (ex develop) and return to renamed branch

    git checkout feature/Name

    and try again your git push

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

    I had the same problem but was resolved. I realized branch name is case sensitive. The main branch in GitHub is 'master', while in my gitbash command it's 'Master'. I renamed Master in local repository to master and it worked!

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

    I solved this in Windows 10 by using cmd instead of GitBash.

    It has to do with character case and how git and command lines handles them.

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