fatal: You are not currently on a branch. To push the history leading to the current (detached HEAD) state now, use code example
Example: after checkout fatal: You are not currently on a branch.
git branch temp-branch
git checkout master
git merge temp-branch
git push origin master