在推送到新的遥控器后缺少参考/头部分支

问题描述 投票:0回答:1

我正在使用以下步骤将存储库从gitolite迁移到bitbucket(on-prem):

1)从gitolite克隆现有的存储库:

git clone [email protected]:/hello-world

2)为bitbucket添加新的遥控器:

git remote add origin-bb ssh://[email protected]:7999/test/hello-world.git

3)将所有分支推送到新的bitbucket原点:

git push origin-bb --all

4)将所有标签推送到新的bitbucket原点

git push origin-bb --tags

推送成功完成且没有错误。但是,当我使用git ls-remote -h origingit ls-remote -h origin-bb比较两个来源之间的参考时,原始遥控器已为所有分支列出了refs / heads,而新遥控器仅列出了refs / heads / master:

git ls-remote -h origin-bb

0079dbeb885c9d88ac200d533930e2e72feb3627        refs/heads/master

git ls-remote -h origin

3215eca2b034d4ee8406bca9b648808fb489c110        refs/heads/hot_fixes
5cfec9cab26d2805064b076d701e53e12ff59c51        refs/heads/develop
61e7efadb6c071f25007dda55ce8c9b73802e1c3        refs/heads/experiment
0079dbeb885c9d88ac200d533930e2e72feb3627        refs/heads/master

这是预期的行为还是在推送到新遥控器时需要一个额外的选项以确保包含所有引用?

git git-push
1个回答
1
投票

git ls-remote origingit ls-remote origin-bb进行比较,但与git ls-remote .进行比较,即与当前的回购比较。我相信你会看到你只有一个分支master,这就是git push --all所推动的。

首先,你需要获取所有分支到本地仓库,因为git clone克隆只有1个分支:

git fetch origin hot_fixes:hot_fixes
git fetch origin experiment:experiment

现在重复git push --all origin-bb

© www.soinside.com 2019 - 2024. All rights reserved.