【问题标题】:How to pull updates from a remote (bare) master repo at Bitbucket to a local bare master repo?如何从 Bitbucket 的远程(裸)主存储库中提取更新到本地裸主存储库?
【发布时间】:2018-08-03 13:50:11
【问题描述】:

首先,在 Bitbucket 中创建一个名为“test”的(裸)主存储库。

然后,在一个ip为10.0.0.1的节点上创建一个本地的bare master repo:

git clone --bare https://username@bitbucket.org/username/test.git

然后,在 ip 10.0.0.253 的节点上创建一个本地工作 repo:

git clone ssh://username2@10.0.0.1:/home/username2/test.git     

因此,10.0.0.x 内的工作流程是:

(1) code on 10.0.0.253 
(2) at 10.0.0.253, git push to 10.0.0.1
(3) at 10.0.0.1, git push to Bitbucket 

假设在10.0.0.x 之外创建了一个本地工作存储库,比如50.113.23.x,并直接从Bitbucket:

mkdir test
cd test
git clone https://username@bitbucket.org/username/test.git

那里的工作流程:

(1) code on 50.113.23.x
(2) at 50.113.23.x, git push to Bitbucket 

现在,您能帮忙评论一下如何将更新从 Bitbucket 存储库拉取到位于 10.0.0.1 的本地裸主存储库吗?以下投诉fatal: This operation must be run in a work tree

git pull origin master

以下完成,但随后的git log 显示没有来自50.113.23.x 的提交:

 git fetch origin master

您能帮忙评论一下这里的解决方法吗?非常感谢!

【问题讨论】:

    标签: git bitbucket git-bare


    【解决方案1】:
    git fetch origin master:master
    

    即显式更新本地master

    【讨论】:

    • 非常感谢您的帮助!你能帮忙评论一下我可以从哪里学到这些知识吗?
    • 开始here 并关注教程、文档和书籍。完全披露——我是那个 wiki 页面的作者。 :-) 当然还有很多痛苦的练习。
    • 再次感谢您!
    猜你喜欢
    • 1970-01-01
    • 2011-11-08
    • 1970-01-01
    • 2013-02-15
    • 2012-08-31
    • 2015-02-22
    • 2015-05-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多