Question

Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.

C:\Users\Allen\Documents\GitHub\project2-pd7 [master]> git status
# On branch master
# Your branch is ahead of 'origin/master' by 5 commits.
#
nothing to commit, working directory clean
C:\Users\Allen\Documents\GitHub\project2-pd7 [master]> git push
Counting objects: 36, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (15/15), done.
Writing objects: 100% (30/30), 3.93 KiB, done.
Total 30 (delta 8), reused 1 (delta 0)
error: unpack failed: index-pack abnormal exit
To https://github.com/stuycs-ml7/project2-pd7.git
 ! [remote rejected] master -> master (unpacker error)
error: failed to push some refs to 'https://github.com/stuycs-ml7/project2-pd7.git'

I'm still trying to find my sea legs with github, but these constant issues are killing me. Could anyone explain the solution in normalspeak so I could understand?

Was it helpful?

Solution 2

Some other student in your class pushed some revisions since your last checkout / pull.

As hd1 pointed out, your best bet is to either git pull, which will likely create a merge commit, after which you might have to explicitly git commit the merge. I prefer git pull --rebase to linearaize the changes before running git push

Run a git log --graph from the command line to get a good visualization of the current state of your local repository.

Do a git fetch to pull down the remote branch without trying to merge or rebase your current changes. This will allow you to inspect the state of the remote repository with git log --graph origin/master

OTHER TIPS

Your history has diverged from the history of the remote branch. Probably somebody has pushed commits to the remote branch since your last git pull. The solution is either:

git pull

or

git pull --rebase

The later tries to rewrite your commits so that they appear at the tip of the branch, rebased on top of the history of the remote branch. The former does a simple merge between your history of the history of the remote branch.

Try git pull before you git push?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top