首页 > 解决方案 > Git推送失败:远程端意外挂断并且未能推送一些参考

问题描述

新的 git 用户在这里。

我曾经能够运行“git push”命令,但它突然停止工作。

$ git push origin master
Enumerating objects: 29, done.
fatal: the remote end hung up unexpectedly
fatal: the remote end hung up unexpectedly
fatal: the remote end hung up unexpectedly
error: failed to push some refs to 'https://<user_name>@bitbucket.org/<user_name>/<file_name>.git'

我已经为 Windows 更新了 Git

$ git --version
git version 2.19.1.windows.1

在添加、提交和推送之前我已经尝试过“git pull”

$ git pull
Already up to date.

我已经尝试过更大的缓冲区

$ git config http.postBuffer 100000000

我已经从我的项目中删除了一个大文件。不知道我还能做什么。

虽然我看到了一些帖子,其中包含我遇到的两个 git 错误之一(远程结束和推送 refs),但没有一个与我发生的事情完全匹配,也没有解决我的问题。

提前致谢!

编辑:我使用 Bitbucket,这个问题只发生在这台 Windows 机器上。在另一台运行 MacOS 的机器上没有问题。

如果有帮助,这是我在 Windows 机器上的 git 状态:

$ git status
On branch master
Your branch is ahead of 'origin/master' by 4 commits.
  (use "git push" to publish your local commits)

nothing to commit, working tree clean

标签: gitbitbucketgit-push

解决方案


考虑到BitBucket 状态报告没有问题,您的 Windows 机器上肯定有问题。

首先尝试:

我在 Windows 机器上有一些我不能丢失的本地更改

然后,作为一种解决方法,您可以创建一个本地 repo 包,将(一个)文件复制到您的 Mac,然后从中提取。然后从 Mac 上的本地仓库推送。


推荐阅读