Git fatal: Reference has invalid format: 'refs/heads/master

前端 未结 8 1601
时光说笑
时光说笑 2021-01-29 18:15

I am using Dropbox to sync a git repository, but now when I try and push I am getting an error:

fatal: Reference has inval         


        
8条回答
  •  [愿得一人]
    2021-01-29 18:38

    I was getting same error

    fatal: Reference has invalid format: 'refs/heads/somebranch (1)'

    for the following command

    git branch
    

    Then, I searched for erroneous name (branch name followed by (1) ) using the command

    find . -name 'somebranch (1)'
    

    And it showed the following result

    ./.git/refs/heads/somebranch (1)

    Which is some duplicated version of somebranch IMO. So, I removed this by executing the find command following by delete

    find . -name 'somebranch (1)' -print -exec rm -rf {} \;
    

    Then the branch command run successfully

    git branch
    

提交回复
热议问题