相关疑难解决方法(0)

Git推送失败,"非快进更新被拒绝"

我通过Git Online编辑了我的GIT存储库.我尝试推送本地代码更改后,出现错误:

Git push failed, To prevent from losing history, non-fast forward updates were rejected.
Run Code Online (Sandbox Code Playgroud)

我怎样才能解决这个问题?

git push github

98
推荐指数
6
解决办法
17万
查看次数

Git推被拒绝"非快进"

我是一个相当新的人,git目前正在使用它来管理团队环境中的代码.我有一些变基础问题,我用它来修复它们

git checkout --ours filename.txt
git add filename.txt
git rebase --continue
Run Code Online (Sandbox Code Playgroud)

现在我想推送我的更改,然后运行以下命令

$ git push origin feature/my_feature_branch
Run Code Online (Sandbox Code Playgroud)

给我以下错误:

To ssh://git@coderepo.com:7999/repo/myproject.git
 ! [rejected]        feature/my_feature_branch -> feature/my_feature_branch (non-fast-forward)
error: failed to push some refs to 'ssh://git@coderepo.com:7999/repo/myproject.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.
Run Code Online (Sandbox Code Playgroud)

我该怎么做才能摆脱这个错误?

PS:我--force尽量避免使用该选项.

git push rebase

71
推荐指数
7
解决办法
19万
查看次数

标签 统计

git ×2

push ×2

github ×1

rebase ×1