Your refs/remotes/origin
目录(这是本地存储库中的目录)存在某种问题。 (我不清楚到底出了什么问题,但你猜测 Android Studio 崩溃时发生的情况对我来说也有可能。)
To fix it, you can probably use the sequence of commands below. Note that I don't recommend it in general—your Git service, whether that's Android Studio or ordinary command-line Git, is not supposed to crash and leave you with a broken repository, so you should never have to do this, it's just an emergency repair, something like putting duct tape all over your car1 after a tree fell on it, just enough to get you to a proper repair / replacement vehicle later:
$ cd $(git rev-parse --show-toplevel) # if necessary
$ rm -rf .git/refs/remotes/origin # remove all origin/*
$ mkdir .git/refs/remotes/origin # create empty origin/
$ git fetch origin # repopulate origin/*
无论如何,您的git push
此时实际上已成功,因为失败的是您的更新origin/master
远程跟踪分支。
你的 Git 刚刚完成与另一个 Git 的对话origin
,给他们(的用户origin
)更新他们的master
, and origin
已接受这些更新,并且您的 Git 现在正在记录以下事实:上次与origin
, their master
被设置为某个特定的提交哈希值——您刚刚推送的哈希值。
(请记住,您的origin/*
远程跟踪分支只是为你记录你的 Git 看到的内容theirGit 有其分支。当你运行时你的 Git 会更新这些git fetch
,您的 Git 与他们的 Git 对话并获取其所有分支。你的 git 还会更新一些(不是全部)git push
,当你的 Git 与他们的 Git 对话并要求他们set一个或多个分支,到你的 Git 传递给它们的哈希值。)
1Except that as a Git mechanic, instead of just duct tape, baling wire, and chewing gum, my recommended parts are actually proper body panels, belts and hoses, and clamps. :-)