I just went to github and created a new project, so far it only has a readme and gitignore files. But I have a project in local which I added to git using
git init
git add .
git commit -m "initial commit"
git remote add origin https://github.com/user/repo.git
I would like to push my project using git push -u origin master
but I get error message containing this
$ git push -u origin master
To https://github.com/user/project.com
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/user/project.com'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
I understand the logic behind this error, but what is the solution? I don't want to pull, as it might erase my local .gitignore file, is there anyway disregard this without force push?