git pull remote branch cannot find remote ref

2020-05-14 05:02发布

I'm not sure why this doesn't work. When I do git branch -a, this is what I see:

enter image description here

I'm trying to pull from the DownloadManager on the online GitHub repository. I have tried

  • git pull, but then it complains about not knowing which branch to pull from
  • git pull origin, doesn't know which branch
  • git pull origin downloadmanager fatal: Couldn't find remote ref downloadmanager. Unexpected end of commands stream
  • git pull origin remotes/origin/DownloadManager 'fatal couldn't find remote ref remotes/origin/DownloadManager. Unexpected end of commands stream

Is there something I'm missing? In Xcode, When I try to connect to the repository, nothing ever shows up. I have been able to push to it in the past. But I can't push again until I pull the most recent changes.

标签: git
9条回答
beautiful°
2楼-- · 2020-05-14 05:10

I had this issue when after rebooted and the last copy of VSCode reopened. The above fix did not work, but when I closed and reopened VSCode via explorer it worked. Here are the steps I did:

//received fatal error
git remote remove origin
git init
git remote add origin git@github:<yoursite>/<your project>.git
// still received an err 
//restarted VSCode and folder via IE 
//updated one char and resaved the index.html  
git add .
git commit -m "blah"
git push origin master

查看更多
别忘想泡老子
3楼-- · 2020-05-14 05:11

If none of these answers work, I would start by looking in your .git/config file for references to the branch that makes problems, and removing them.

查看更多
放我归山
4楼-- · 2020-05-14 05:13

The branch name in Git is case sensitive. To see the names of your branches that Git 'sees' (including the correct casing), use:

git branch -vv

... and now that you can see the correct branch name to use, do this:

git pull origin BranchName 

where 'BranchName' is the name of your branch. Ensure that you match the case correctly

So in the OP's (Original Poster's) case, the command would be:

git pull origin DownloadManager
查看更多
姐就是有狂的资本
5楼-- · 2020-05-14 05:13

For me, it was because I was trying to pull a branch which was already deleted from Github.

查看更多
▲ chillily
6楼-- · 2020-05-14 05:19

This is because your remote branch name is "DownloadManager“, I guess when you checkout your branch, you give this branch a new name "downloadmanager".

But this is just your local name, not remote ref name.

查看更多
闹够了就滚
7楼-- · 2020-05-14 05:20

check your branch on your repo. maybe someone delete it.

查看更多
登录 后发表回答