Home  >  Q&A  >  body text

gitclone下来的代码库能成为另一个repo吗

现在有这样的一种需求,服务器A上有一个repo,在服务器B上git clone了这个repo,现在由于某些限制开发人员只能访问到服务器B上,所以想在服务器B上设置一个repo供开发人员clone,开发模式就变成

本地 push-->>服务器B push-->>服务器A

但不知道如何将服务器A的repo,服务器B上的repo,以及本地的代码库关联起来?

PHP中文网PHP中文网2732 days ago668

reply all(1)I'll reply

  • 漂亮男人

    漂亮男人2017-04-28 09:08:19

    Of course, directly on server B
    git clone plus --bare parameters

    It’s okay if you don’t add --bare, but when you clone from the server, there will be an extra layer of .git directory

    Server B’s repo can be set up with post-receive git hooks
    Let him actively push the code to server A after receiving the submission


    1. Get the git repo of server A on server B

    cd ~
    git clone serverA-repo --bare
    

    2. Get the git repo of server B locally

    git clone serverB:example.git
    

    reply
    0
  • Cancelreply