'Fetch upstream from another repo and then push the changes in my local branch

I have two projects one is a mirror from another and I have a branch in the no mirror project that I need to move to the mirror project.

I'm doing the next:

git remote add upstream https://github.com/my/nomirrorProject.git
git fetch upstream upstreamBranch:mylocalbranch

But I'm getting the next error message:

fatal: Refusing to fetch into current branch refs/heads/myLocalBranch of non-bare repository

git push origin mylocalbranch

Any ideas?

Thanks!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source