OPAM 无法发布包 - 说 git 无法获取

OPAM fails to publish a package - says git failed to fetch

我正在尝试使用此处的说明发布 opam 包: https://opam.ocaml.org/doc/Packaging.html

我确实创建了一个标签并将其推送到 github。 当我尝试使用 opam publish 在 opam 上发布它时,我收到以下错误消息:

Fetching the package repository, this may take a while...
[ERROR] Uncaught exception: "/usr/bin/git fetch --multiple origin user" exited with code 128 "fatal: No such remote or remote group:
        user"

我是否错误地设置了 git 存储库,或者我的 opam 安装是否需要一些调整才能使其正常工作?

我根据此处描述的问题找到了答案: https://github.com/ocaml/opam-publish/issues/92

解决方法是删除文件夹: <opam root>/plugins/opam-publish/repos/ocaml%opam-repository

可以通过命令opam config list找到(在root中寻找变量=]全局 opam 变量 部分)

也许在你看到这个错误之前

/usr/bin/git fetch --multiple origin user" exited with code 128 "fatal: No such remote or remote group: user

您错过了一个 401 Unauthorized 错误,这与更新的 github-unix 包中的错误有关 GitHub 弃用了 API。

这是我清理它的方法。

清理剩余的 opam-publish 状态

rm -rf ~/.opam/plugins/opam-publish/repos/ocaml%opam-repository
rm -f ~/.opam/plugins/opam-publish/ocaml%opam-repository.token

将 github-unix 降级到 <4.3.0

opam install github-unix.4.2.0

运行 opam publish 再一次。

参考资料