-1

I’m trying to deploy my project to GitHub. All good, when I write npm run build, then npm deploy. But when I write git push origin master, then I saw this

 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://github.com/voloxatyj/React-task.git'
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.

In settings(Git domain) I choose gh-pages branch. And install this package, and write in package.json, homepage and scripts. What I’m doing wrong????

Sultan H.
  • 2,908
  • 2
  • 11
  • 23
Ostap
  • 75
  • 8
  • Possible duplicate of [git: updates were rejected because the remote contains work that you do not have locally](https://stackoverflow.com/questions/24357108/git-updates-were-rejected-because-the-remote-contains-work-that-you-do-not-have) – phd Jul 11 '19 at 10:55
  • https://stackoverflow.com/search?q=%5Bgit%5D+hint%3A+Updates+were+rejected+because+the+remote+contains+work – phd Jul 11 '19 at 10:55

1 Answers1

0

It's a git error, not directly linked to react.js, it seems that the branch you are trying to push updates to, is out of date, it means, that in your repository, the branch gh-pages have some changes that are not pulled into your local machine.

this can be fixed normally by doing the following command, make sure you commit your changes before you execute that command.

git pull origin branch-name

Replace branch-name with the branch you are working on.

After that you may proceed with git push origin branch-name

Sultan H.
  • 2,908
  • 2
  • 11
  • 23