. Advertisement .
..3..
Hello everyone, I am getting the error”git cannot be resolved to branch”. I moved my repositories from Github or Bitbucket. Although I don’t think it matters, this is the only thing that differs. I briefly set up two remote controls:
origin: bitbucket
github: github
After that, I deleted both and sent the origin to github:
git remote remove origin
git remote remove github
git remote add origin https://github....
push test for the develop branch:
git push origin develop
Everything done
As usual, create a new branch for some work.
git checkout -b Feature/Name
Update one or more files. Pushing the remote is attempted:
git push origin Feature/Name
But it appeared this error:
fatal: Feature/Name cannot be resolved to branch
This command was ran:
git push --all -u
my Feature/Name branch was taken to github,
But it don’t change.
git push origin develop
git push origin Feature/Name
I don’t know the reason why it is getting this error. Please help me!
The cause:
Before you push a new branch to GitHub or GitLab, you must tell your local Git installation about the remote Git repository your branch should be pushed to.
The solution:
This problem was also bothering me, and it was driving me mad. Git branch -a revealed FEATURE/name when I had something similar to feature/name. Nothing worked when the branch was renamed, deleted, and then recreated. What made it eventually work:
Go into .git/refs/heads
A FEATURE folder will be visible. Call it a feature instead.