Github failed push
So to make a long story short, I’ve been working on a web app for the past few months. Recently I had to get a new laptop and cloned the repository from github onto my new machine… However whenever I commit changes to my app and attempt to use
git push -u in the app’s root directory i get the following message:
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'email@example.com:acc/etc.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.
but when I try
git pull firstname.lastname@example.org:acc/etc.git master I get a message telling me that the pull was aborted.
* branch master -> FETCH_HEAD
error: Your local changes to the following files would be overwritten by merge:
Please, commit your changes or stash them before you can merge.
so then i commit my changes using
git commit -m 'fixing' and then attempt
git pull again.
however this time I got messages stating that practically all my files had an “Auto-Merging CONFLICT”
am i totally screwed with this particular repository? I’m not really sure what to do since git is still somewhat new to me….
2 Solutions collect form web for “Github failed push”
If the changes aren’t that big, consider making a copy of the entire folder/project in a different directory outside of the project, then
git reset --hard HEAD will wipe out, erase and delete your recent changes.
You can then apply them again individually using your save3d copies for refernce.
Make sure sure you
git add before
git commit of course.
Finally if you get auto commit merge issues you can always just edit the files manually to resolve.
am i totally screwed with this particular repository?
No, but you will have to do a manual merge, since Git can’t figure it out.
git status will tell you which files need editing. The files themselves contain markers indicating where you should edit. When that’s done,
git push should work again.