git pull displays “fatal: Couldn't find remote ref refs/heads/xxxx” and hangs up

前端 未结 9 896
醉话见心
醉话见心 2021-01-31 06:58

I created a branch called \'6796\', then I pushed it to remote, checked it out on another machine, made other edits, pushed it, then merged it with the master, and deleted it -

相关标签:
9条回答
  • 2021-01-31 07:27

    I had the same issue. But in my case it was due to my branch's name. The branch's name automatically set in my GitHub repo as main instead of master.

    git pull origin master (did not work).

    I confirmed in GitHub if the name of the branch was actually master and found the the actual name was main. so the commands below worked for me. git pull origin main

    0 讨论(0)
  • 2021-01-31 07:33

    You also have to delete the local branch:

    git branch -d 6796
    

    Another way is to prune all stale branches from your local repository. This will delete all local branches that already have been removed from the remote:

    git remote prune origin --dry-run
    
    0 讨论(0)
  • 2021-01-31 07:41

    I have same error. Problem was that branch was deleted, released. But in PhpStorm I still could see it in remote branches. I could checkout as local branch. And then doing git pull was giving this error.

    So need to check if this brnach really exists remotely.

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