English 中文(简体)
GitHub - 错误: 无法将一些 refs 推进到
原标题:GitHub - error: failed to push some refs to

我在下面执行这些命令:

git add .
git commit -m  t 

然后,当执行以下命令时:

git push origin development

我犯了以下错误:

To [email protected]:myrepo.git
 ! [rejected]        development -> development (non-fast-forward)
error: failed to push some refs to  [email protected]:myrepo.git 
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g.  git pull ) before pushing again.  See the
 Note about fast-forwards  section of  git push --help  for details.

是否有办法解决上述错误?

最佳回答

您的源仓库在本地仓库前。 您需要先从源仓库中按以下方式拉动更改才能按下。 这可以在您的承诺和推动之间执行 。

git pull origin development

development refers to the branch you want to pull from. If you want to pull from master branch then type this one.

git pull origin master
问题回答

以我为例,吉图博倒下了

也可以检查“https://www.githubstatus.com/'rel=“noreferrer'>https://www.githubstatus.com/

您可以订阅每个电子邮件和文本的通知, 以便知道何时可以再次按下更改 。

I have faced the same issue and resolved as follows (if you have a project in local folder then follow the steps):

  1. create a new repo in GitHub
  2. go to local folder and do "git init"
  3. git remote add origin (with your repo url) // simply copy from your repo
  4. git add -A
  5. git commit -m "your commit"
  6. git push -u origin master

我也得到了错误 < code>! [ 远程拒绝] 主 - & gt; 主( 失败) 错误: 未能将一些 refs 推进到 & lt; repostial& gt;

之所以要找出这个原因:

就我而言,我犯了错误,因为我忘记了在 Github 上创建现有项目的存储库之后做出承诺。所以我解决了:

git add .
git commit -m"commentary"

然后我可以打字:

git push -u origin master

我使用这个命令,它的工作对我很好:

>git push -f origin master

但请注意, 这可能会删除您在远程回购上已经拥有的一些文件 。 这对我有用, 因为情况不同; 我将本地项目推到远程回购, 远程回购是空的, 但是 READ 。

您可以在您的控制台中写入 :

git pull origin

然后按 TAB 键并写入您的“ 主机” 仓库

尝试此 :

  1. git push -u origin master
  2. git push -f origin master

#1有时工作,有时为我工作,有时为我工作。我不知道为什么它会这样反应

在窗口中, 您需要使用双引号“ ” 。 所以命令将会是

git 承诺 - m "t"

在我的情况中,git push 试图更用力地推,只推当前分支,因此,我犯了这个错误,因为其他分支不同步。

To fix that you could use: git config --global push.default simple That will make git to only push the current branch.

这只能适用于最新版本的git.,即:将用1.7.9.5。

这个命令对我有效:

git push --set-upstream origin master

如果它不起作用,请确保您正在推动当前分支,您正在推动当前分支。

App University>git branch
* master
  test

在那之后,你必须把代码推到主分支上

 App University>git push origin master
$ git fetch --unshallow origin
$ git push you remote name

I have faced below error $ git push origin main error: src refspec main does not match any error: failed to push some refs to https://github.com/--------/git-init-sample.git

解答:我没有连接到 Git 本地 repo < a href="https://github.com/login/oauth/ perfective? refuse_type=" rel="nolfollow noreferrer">https://github.com/login/oauth/ perfective?回应_type_ {/a>

i 连接错误一旦发生错误

$ git push origin main Enumerating objects: 3, done. Counting objects: 100% (3/3), done.

此错误相同, 但细节不同, 可能与存储处隐私设置的更改有关。 细节实际上非常清楚 。

In example: I changed my profile settings to hide my email address and that has an effect in all my repositories. However you can keep that setting checked and uncheck "Block command line pushes that expose my email" option in the Email Setting section

我可以用“强力”“力”“/强”来推:

git push origin --force




相关问题
git confusion - cloning a repo is returning a past version

Im having some confusion with my git usage. I cloned a repo from one comp to the other, and the new clone is the state of the original that was active some time ago. So its cloning a past version. ...

Appropriate strategy for tagging and hotfixing with git

I was wondering if the strategy I m using for tagging and hotfixing tags (which then I use for deploying rails applications) with git is appropriate. For tagging I just tag a commit of the master ...

Tips on upgrading CVS to git/hg?

We still use CVS, I use git and hg for my personal use though I m still a novice at both, but I realize they re much more modern and better, faster, distributed, etc. It s just everyone is so ...

Using Git in a TFS shop

Using Git at home has spoiled me - I now find using TFS at work to be a bit of a drag and want to explore the possibility of using Git locally and syncing somehow with TFS. I figure there are a few ...

热门标签