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:

To git@github.com:acc/etc.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.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.

  • How to propagate local branch deletion to remote in 1 step - git, github
  • How do I commit case-sensitive only filename changes in Git?
  • fatal: Not a valid object name: 'master'
  • Android Studio Gradle Builds Slow After Project Added to Git
  • Why isn't Git listening to my working tree argument?
  • bitbucket stripped git revisions
  • but when I try git pull git@github.com:acc/etc.git master I get a message telling me that the pull was aborted.

    From github.com:acc/etc
    * branch master -> FETCH_HEAD
    error: Your local changes to the following files would be overwritten by merge:
    config/routes.rb
    test/fixtures/users.yml
    Please, commit your changes or stash them before you can merge.
    Aborting

    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….

  • Does any Version Control System like SVN, Git, or Mercurial let you “keep latest version” but not the revisions? (such as for binary files)
  • Why does “git log --name-only” show one file change, but “git diff” shows more?
  • Unstaged changes immediately after cloning in Eclipse
  • Does GIT supports mirroring or proxy concept?
  • What is libintl.h and where can I get it?
  • Easiest way to copy ssh key (Used for GIT) from one linux machine to another
  • 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.

    Git Baby is a git and github fan, let's start git clone.