【问题标题】:How can I clone a git repository to another machine?如何将 git 存储库克隆到另一台机器?
【发布时间】:2013-07-28 14:19:29
【问题描述】:

假设我在机器 A(本地)上有一个 git 存储库。我想将它克隆到机器B(很远),就好像我ssh-ed到B上并运行git clone me@A:/repo.git,但我只能从A到B,而不是从B到A。那么我该如何克隆从 A 到 B 的 repo?

【问题讨论】:

    标签: git ssh git-clone


    【解决方案1】:

    在遥控器上。

    git init $DIR/$PROJECT
    

    本地

    git remote add $remote user@machine:$DIR/$PROJECT
    git fetch $remote
    git push $remote branch
    

    应该没问题。

    【讨论】:

      【解决方案2】:

      您有几种方法(协议)取决于您的安装。 您可以按照上一个答案添加远程+获取形式,也可以使用以下协议之一直接克隆 - ssh/http/git。

      您需要问自己另一个问题 - 您需要对克隆的存储库进行只读还是读写凭据。

      更多关于不同协议和更多信息:(包括如何克隆)

      http://git-scm.com/book/ch4-1.html

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-08-15
        • 1970-01-01
        相关资源
        最近更新 更多