gitatlassian-sourcetreebitbucket-server

Can't Push or Pull in Git


I'm fairly new to using Git, but I do understand the bare basics. However, I have yet to encounter a situation where I have Push/Pull conflicts...until now.

Also, I should point out that the GUI tool I'm using to interact with the Git repository is Atlassian SourceTree (We're using Atlassian Stash to manage our repo's).

Here is the scenario:

I have 2 commits to Push and apparently there are 4 changes that I need to Pull.

When I try to Pull I get this:

git -c diff.mnemonicprefix=false -c core.quotepath=false fetch origin

git -c diff.mnemonicprefix=false -c core.quotepath=false pull --no-commit origin master
You have not concluded your merge (MERGE_HEAD exists).

Please, commit your changes before you can merge.

Completed with errors, see above.

It says that I need to complete my merge but it's not allowing me to do anything. I don't get a merge list nor is it auto-merging. I can't seem to get past the merge so I can proceed to resolve the Push/Pull conflict.

When I try to Push I get this:

git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --tags origin master:master
Pushing to http://XXXXXX@XXXXXXXX.XXXX.XXXX:XXXX/XXXX/XXXX/XXXXX.git
To http://XXXXXX@XXXXXXXX.XXXX.XXXX:XXXX/XXXX/XXXX/XXXXX.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'http://XXXXXX@XXXXXXXX.XXXX.XXXX:XXXX/XXXX/XXXX/XXXXX.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.

Now how the heck do I resolve this?! Am I going to have to Rebase or something like that?

I was reading about a Fast Forward Push but I have no clue how to do that within this tool. If I have to, I can certainly execute the Git commands from the terminal. I just didn't want to jump into that without consulting someone with with a better understanding of Git and these types of issues.


Solution

  • It looks like you're in the middle of a merge(perhaps a previous attempt?)

    git merge --abort will cancel that merge, and put you in a state where you can retry the pull and then resolve conflicts.