While working on a project I encountered the following error:
fatal: The current branch [name of branch] has no upstream branch.
Upon closer inspection the issue was that the branch that git was tracking, which had the same name, had the first letter in uppercase (e.g. Fix), while the branch that I was using had its first letter in lowercase (e.g. fix). This caused confusion for git. In order to fix it, I had to do the following:
-
In the root directory of your project go to
.git/refs/heads
. -
Inside that directory change the name of the branch that is causing the problem from uppercase (e.g. Fix) to lowercase (e.g. fix) (
mv Fix fix
). -
Return to the root directory of your project.
-
Type
git push
at the command line and your files that have been committed should be pushed without any more errors.