The supplied answers didn't work for me.
I had an empty repo on GitHub with only the LICENSE file and a single commit locally. What worked was:
$ git fetch
$ git merge --allow-unrelated-histories
Merge made by the 'recursive' strategy.
LICENSE | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
create mode 100644 LICENSE
Also before merge
you may want to:
$ git branch --set-upstream-to origin/master
Branch 'master' set up to track remote branch 'master' from 'origin'.