Reputation: 1406
I'm working on a site and I am using React-create-app and it's webpack configuration. I had been pushing to a Github repo without any issues. A couple days ago I turned the site I am making into a Github Pages site (i.e. mygithubname.github.io).
After turning this repo into a Github Pages site the structure of my project's repo changed. It looks like it minimized the code for the sake of putting it online. Once I pushed this repo and made it a live Github Pages site all of a sudden I couldn't push to the repo anymore.
If I push to the repo I get an error:
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/Nicknyr/New_Portfolio.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
I have done some searching online and I have attempted to do a git pull origin master
to correct the issue. If I try that it deletes 75% of my project and most of my components go missing. This is the result of git pull origin master
:
git pull origin master
From https://github.com/Nicknyr/New_Portfolio
* branch master -> FETCH_HEAD
Removing yarn.lock
CONFLICT (modify/delete): src/styles/_Projects.scss deleted in 5977716b3eb3a9424a9efdbf835a0a2ae9cf6f88 and modified in HEAD. Version HEAD of src/styles/_Projects.scss left in tree.
CONFLICT (modify/delete): src/styles/_Info.scss deleted in 5977716b3eb3a9424a9efdbf835a0a2ae9cf6f88 and modified in HEAD. Version HEAD of src/styles/_Info.scss left in tree.
Removing src/styles/_Header.scss
CONFLICT (modify/delete): src/styles/_Global.scss deleted in 5977716b3eb3a9424a9efdbf835a0a2ae9cf6f88 and modified in HEAD. Version HEAD of src/styles/_Global.scss left in tree.
Removing src/styles/_Footer.scss
Removing src/styles/_ContactForm.scss
Removing src/styles/_Contact.scss
Removing src/registerServiceWorker.js
Removing src/logo.svg
Removing src/index.js
Removing src/index.css
Removing src/images/tic-tac-toe-medium.png
Removing src/images/steem-medium.png
Removing src/images/resume-new.png
Removing src/images/resume-medium.png
Removing src/images/redo.png
Removing src/images/pomodoro-small.png
Removing src/images/placeholder.png
Removing src/images/nodes-no-color.jpg
Removing src/images/name-logo.png
Removing src/images/name-logo-small.png
Removing src/images/euro-small.png
Removing src/images/euro-large.png
Removing src/images/euro-250.png
Removing src/images/centered.png
Removing src/images/blue-nodes-opacity.jpg
Removing src/images/background-2462434_1920.jpg
CONFLICT (modify/delete): src/Projects.js deleted in 5977716b3eb3a9424a9efdbf835a0a2ae9cf6f88 and modified in HEAD. Version HEAD of src/Projects.js left in tree.
Removing src/NodeMailer.js
CONFLICT (modify/delete): src/Menu.js deleted in 5977716b3eb3a9424a9efdbf835a0a2ae9cf6f88 and modified in HEAD. Version HEAD of src/Menu.js left in tree.
Removing src/Info.js
CONFLICT (modify/delete): src/Header.js deleted in 5977716b3eb3a9424a9efdbf835a0a2ae9cf6f88 and modified in HEAD. Version HEAD of src/Header.js left in tree.
Removing src/Footer.js
Removing src/ContactForm.js
CONFLICT (modify/delete): src/Contact.js deleted in 5977716b3eb3a9424a9efdbf835a0a2ae9cf6f88 and modified in HEAD. Version HEAD of src/Contact.js left in tree.
Removing src/App.test.js
Removing src/App.scss
CONFLICT (modify/delete): src/App.js deleted in 5977716b3eb3a9424a9efdbf835a0a2ae9cf6f88 and modified in HEAD. Version HEAD of src/App.js left in tree.
CONFLICT (modify/delete): src/App.css deleted in 5977716b3eb3a9424a9efdbf835a0a2ae9cf6f88 and modified in HEAD. Version HEAD of src/App.css left in tree.
Removing public/index.html
CONFLICT (modify/delete): package.json deleted in 5977716b3eb3a9424a9efdbf835a0a2ae9cf6f88 and modified in HEAD. Version HEAD of package.json left in tree.
Removing README.md
Removing .gitignore
Automatic merge failed; fix conflicts and then commit the result.
It deletes most of my project. I undid this via git reset --hard
. I got my project files back but I still can't push to Github.
Here is what happened to my repo after making my site into a Github Pages site. As you can see it deleted most of my project and this appears to be what I am reverting back to when I go git pull origin master
.
How do I straighten this out? I want to get my branch on track so that I can continue pushing to it without losing all these files.
Upvotes: 0
Views: 518
Reputation: 318
Make aure you have commited your files or directory
git add .
Or a file/directory name instead of "."
git commit --all
git push origin master
Also you need to make sure that you are not behind the already pushed code. If it is that so, this error will be raised
Upvotes: 0