如何在在线存储库本身上存档我的存储库的一个版本?

How to archive a version of my repository on the online repository itself?

我知道 git archive 可以在机器本地创建存储库的存档文件。我想将其在线存储在我的存储库中。

例如,看下面的link:

https://github.com/opencv/opencv_contrib/archive/3.4.6.tar.gz

如您所见,存档存储在 git 存储库中。我如何在 gitlab 或 github 中做到这一点?

您的 link 指向 GitHub "release"。 Gitlab 中也有该功能,但目前,您只能通过 Releases API 创建 Release 条目;建议将此作为 CI/CD 发布管道的最后步骤之一。

GitLab 发布:https://docs.gitlab.com/ee/user/project/releases/index.html

GitHub 发布:https://help.github.com/en/articles/creating-releases