【问题标题】:Push tags/releases from fork to origin in git在 git 中将标签/发布从 fork 推送到 origin
【发布时间】:2021-07-13 16:05:21
【问题描述】:

我在 GitHub 存储库的一个分支上进行开发工作。我可以在任何提交上创建带注释的标签并按如下方式推送它们:

# cd to my fork
git tag -a c1.0.1 <commit-id> -m "my v1.0.1"
git push origin v1.0.1

但是,这些标签显示在 fork 中的 Release/Tags 页面中,但不在 origin 中。

我使用manual method on GitHub 在最新代码上创建了一个新版本和标签,但我不能将它用于旧提交。也许我可以克隆源并从那里推送标签,因为我应该拥有所有权限,但我可能会在以后的版本中忘记这样做。

如何将我的 fork 上的标签推送到原点,以便它出现在原点的发布/标签页面中?

【问题讨论】:

    标签: git github


    【解决方案1】:

    来自我的 fork,它的上游设置如下:

    git remote -v
    origin  https://github.com/<myusername>/somerepo.git (fetch)
    origin  https://github.com/<myusername>/somerepo.git (push)
    upstream    https://github.com/<origin>/somerepo.git (fetch)
    upstream    https://github.com/<origin>/somerepo.git (push)
    
    

    我可以这样做:

    git push --tags upstream

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-09-08
      • 1970-01-01
      • 2016-09-19
      • 2023-03-29
      • 2023-03-28
      • 2020-09-16
      • 2015-02-04
      相关资源
      最近更新 更多