I'm not sure why this doesn't work. When I do git branch -a
, this is what I see:
I'm trying to pull from the DownloadManager on the online GitHub repository. I have tried
fatal: Couldn't find remote ref downloadmanager. Unexpected end of commands stream
'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.
This question is related to
git
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.
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_x000D_
git remote remove origin_x000D_
git init_x000D_
git remote add origin git@github:<yoursite>/<your project>.git_x000D_
// still received an err _x000D_
//restarted VSCode and folder via IE _x000D_
//updated one char and resaved the index.html _x000D_
git add ._x000D_
git commit -m "blah"_x000D_
git push origin master
_x000D_
check your branch on your repo. maybe someone delete it.
For me, it was because I was trying to pull a branch which was already deleted from Github.
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.
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
This error happens because the local repository can't identify the remote branch at first time. So you need to do it first. It can be done using following commands:
git remote add origin 'url_of_your_github_project'
git push -u origin master
You need to set your local branch to track the remote branch, which it won't do automatically if they have different capitalizations.
Try:
git branch --set-upstream downloadmanager origin/DownloadManager
git pull
UPDATE:
'--set-upstream' option is no longer supported.
git branch --set-upstream-to downloadmanager origin/DownloadManager
git pull
Source: Stackoverflow.com