我在synology nas中有一个git服务器。现在,我已经将gitlab安装到了一个新的服务器上,我想在该服务器上导入我所有的存储库。据我所知,我必须从我的git服务器克隆每个存储库,并逐个手动导入它们。所以我开始克隆我的存储库:
git clone ssh://usuario@servidor/ruta/repositorio.git repositorio然后我移动到存储库文件夹,为新服务器添加一个新的遥控器,并推送:
cd repositorio
git remote rename origin origin-git
git remote add origin ssh://git@gitlab/url/repository.git
git push -u origin --all
git push -u origin --tags现在我到了我的gitlab,我可以看到我的主分支及其所有的提交。我还可以看到其他提交,但我的问题是它们没有分配给任何分支。
在这里你可以看到gitlab生成的提交图片。应该有另一个分支叫做desarrollo。

如果我试图从Gitlab克隆这个存储库,我看不到所有这些提交,因为唯一存在的分支是master。
编辑:添加git fetch --all或git pull --all不会有任何不同。
发布于 2020-11-12 17:33:03
添加git fetch --all或git pull --all根本不起作用。它不加载除master之外的任何其他分支。您可以使用git branch查看本地分支,使用git branch -a查看本地和远程分支。
解决方案是跟踪所有分支,为此添加一些代码,并在重命名origin之前运行它:
# Track all branches
for branch in $(git branch --all | grep '^\s*remotes' | egrep --invert-match '(:?HEAD|master)$'); do
git branch --track "${branch##*/}" "$branch"
done
# Pull fetched branches, just in case
git fetch --all
git pull --all然后像往常一样重命名原点,并推送所有内容。
git remote rename origin origin-git
git remote add origin ssh://git@gitlab/url/repository.git
git push -u origin --all
git push -u origin --tags完成所有这些工作后,您可以查看gitlab,您将看到所有分支都已同步。
获取所有分支的解决方案如下:How to fetch all Git branches
https://stackoverflow.com/questions/64782803
复制相似问题