混帐拒绝推动非快进

问题描述 投票:14回答:6

我很新的混帐,我一直在研究小方项目过去2个月,并已推到的东西用到位桶没有问题。几天以前,我拉上我的项目文件夹(因为我不得不重新安装我的Linux操作系统),现在我的Linux操作系统重新安装后解压这一点。

所以,现在,我去了我的项目文件夹,保持愉快地工作,终于做到了:

git add -A && git commit -m "modified code" && git push origin master

..这是我平时做..

我得到:

To https://[email protected]/johnsproject/proj.git
! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://[email protected]/johnsproject/proj.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

我有看,他们建议使用力标志-f几SO问题 - 但我不确定我是否应该这样做。

P.S:我在主分支 - 这是对我的回购协议only分支。

真的很感激,如果有人可以点我朝着正确的方向。

谢谢。

git bitbucket git-commit
6个回答
22
投票

有在中央资料库,你必须拉之前,你可以把变化。做

git add -A
git commit -m "my local changes" 
git pull

解决任何冲突。然后做

git push

另外,如果你在本地没有有价值的修改,您可以创建回购新克隆,并从那里开始工作:

git clone https://[email protected]/johnsproject/proj.git new_repo_dir

10
投票

试着做

git pull origin master
git add -A
git commit -m "modified code"
git push origin master

你的本地仓库很可能走出与远程存储库同步。


6
投票

我有同样的问题。我固定通过使用强制更新git push -f命令。


0
投票

对我的作品git push --set-upstream origin master -f


0
投票

在我的情况是从git仓库新的文件不添加,这是解决办法1. git的状态(只是为了检查)2. git的补充。 3.混帐推-u主产地


0
投票

您可以尝试git的拉动,在这之后的git在工作室承诺,那混帐推起源的分支名之后。

© www.soinside.com 2019 - 2024. All rights reserved.