我如何停止git push悄无声息地发布本地提交

时间:2018-11-30 06:17:26

标签: git github

我正在处理github存储库的分叉,成功推送了两次,但是现在git push悄悄地无法发布我的本地提交:

$ git version
git version 1.8.3.1

$ git remote -v
origin  git@github.com:martinwaite/vault.git (fetch)
origin  git@github.com:martinwaite/vault.git (push)

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

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

请问,关于这里出了什么问题以及如何解决的任何想法?

1 个答案:

答案 0 :(得分:1)

尝试使用https重置遥控器的URL:

git remote set-url origin https://github.com/martinwaite/vault.git

然后获取远程仓库:

git fetch

再次检查本地分支是否正在跟踪远程分支

git branch -vv

如果不是这种情况,请让本地分支跟踪远程分支

git branch -u origin/batch_hmac

最后推送提交

git push

如果仍然无法正常工作,请尝试--force推送

git push --force