sbt-ghpages fatal: Not a git repository (or any of the parent directories): .git

sbt-ghpages fatal: Not a git repository (or any of the parent directories): .git

所以我以前完全没有问题地做过这个。我在 GitHub 项目的 master 分支上。我创建了一个新分支 git checkout --orphan gh-pages,将其清除,并将其推送到 origin。我要回到 master,我的 build.sbt 所在的目录 site 内,我 运行 sbt ghpages-push-site。我看到这个错误

[error] fatal: Not a git repository (or any of the parent directories): .git

然后在构建 API 文档后,sbt 退出并出现上述错误 git。不用说 ../.git 存在。

这似乎是一个缓存问题。 运行 sudo rm -r ~/.sbt/ghpages/ 然后再试一次成功了。