简体   繁体   English

不能推或拉Git

[英]Can't Push or Pull in Git

I'm fairly new to using Git, but I do understand the bare basics. 我是使用Git的新手,但我确实理解了基础知识。 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). 另外,我应该指出,我用来与Git存储库交互的GUI工具是Atlassian SourceTree(我们使用Atlassian Stash来管理我们的repo)。

Here is the scenario: 这是场景:

I have 2 commits to Push and apparently there are 4 changes that I need to Pull . 我有2个提交Push ,显然我需要Pull 4个更改。

When I try to Pull I get this: 当我尝试Pull我得到这个:

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. 我似乎无法通过合并,所以我可以继续解决Push/Pull冲突。

When I try to Push I get this: 当我尝试Push我得到这个:

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? 我要去Rebase还是那样的?

I was reading about a Fast Forward Push but I have no clue how to do that within this tool. 我正在阅读有关Fast Forward Push但我不知道如何在此工具中执行此操作。 If I have to, I can certainly execute the Git commands from the terminal. 如果必须,我当然可以从终端执行Git命令。 I just didn't want to jump into that without consulting someone with with a better understanding of Git and these types of issues. 我只是不想在没有咨询有更好理解Git和这些类型问题的人的情况下跳进去。

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. git merge --abort将取消该合并,并使您处于可以重试拉动然后解决冲突的状态。

Complete your merge. 完成合并。 git status will tell you what is hanging out. git status会告诉你什么是闲逛。 For each one, you need to edit to fix the conflict and do git add . 对于每一个,您需要编辑以修复冲突并执行git add Then git commit . 然后git commit Then pull, then push. 然后拉,然后推。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM