【问题标题】:git: how to document that a repo has been shut down?git:如何记录回购已被关闭?
【发布时间】:2018-02-26 16:06:56
【问题描述】:

我在 server1.example.com 有一个旧的 repo 服务器,我想将所有 git 存储库转移到 git.example.com。 git 是否支持配置server1.example.com,以便万一有人仍然尝试fetchpushclone 他们的工作区反对server1.example.com,他们会收到一条自定义错误消息“error: server1.example.com has been shut down, use git.example.com instead”?

【问题讨论】:

    标签: git configuration repository transfer


    【解决方案1】:

    您可以使用简单的git hook:挂钩是在特定情况下执行的脚本。您可以设置服务器端预接收挂钩,当有人尝试推送到您的存储库时始终运行,该挂钩始终以退出代码 1 退出(因此将拒绝每次推送)并显示 error: server1.example.com has been shut down, use git.example.com instead 消息。

    可以在here 找到一个示例(对于您的情况可能过于复杂)。

    不过,这仅适用于推送。 herefetch here 讨论了 clone 钩子之类的可能性,但两者都没有 git 内部功能。

    【讨论】:

      猜你喜欢
      • 2015-08-17
      • 1970-01-01
      • 2014-03-17
      • 1970-01-01
      • 2020-11-03
      • 2018-04-06
      • 1970-01-01
      • 2012-11-15
      • 2018-05-27
      相关资源
      最近更新 更多