无论我做什么,我都无法推送代码并保持收到相同的错误 [英] I can't push my code and keep getting the same error no matter what I do

查看:90
本文介绍了无论我做什么,我都无法推送代码并保持收到相同的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将代码推送到我的远程分支,但始终收到此错误:

I'm trying to push my code to my remote branch but keep receiving this error:

! [rejected] (non-fast-forward)
error: failed to push some refs to 'git@github.com:
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

我认为这可能是由于我在github上的README.md中而不是通过本地环境修复了一个错字.

I think what may have caused this was the fact that I fixed a typo in my README.md on github instead of through my local environment.

我在整个堆栈中查找了所有内容,并尝试了他们针对此问题提到的命令,例如git pullgit pull --rebasegit pull origin mastergit push --f以及许多其他无济于事的命令.

I've looked all over stack overflow and tried the commands they mentioned for this problem such as git pull , git pull --rebase , git pull origin master , git push --f and many others with no avail.

我也尝试了以下问题的答案,但没有成功:

I've also tried the answers in the following questions, with no success:

更新之所以被拒绝,是因为您当前分支的提示位于提示之后:它的远程对应对象.整合远程更改(例如[重复]

无法推送到GitHub-一直在说需要合并

Git从GitHub拉某个分支

Git pull a certain branch from GitHub

我也尝试过git pull upstream master,但出现此错误:

I also tried git pull upstream master and I get this error:

fatal: 'upstream' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

推荐答案

问题已解决:

我添加了另一个更改并将其保存在本地环境中,并执行以下操作:

I added another change and saved it in my local environment and did the following:

git stash

git pull origin <branch-name> -v

git add .

git commit

git push origin <branch-name>

这篇关于无论我做什么,我都无法推送代码并保持收到相同的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆