Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/hadoop/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将GitHub镜像到Bitbucket?_Git_Github_Bitbucket - Fatal编程技术网

如何将GitHub镜像到Bitbucket?

如何将GitHub镜像到Bitbucket?,git,github,bitbucket,Git,Github,Bitbucket,我有一个从GitHub克隆的回购协议,我想在BitBucket上镜像这个回购协议。有没有办法做到这一点?我认为回购协议中有两个来源。您只需添加第二个远程: git remote add bitbucket /url/to/am/empty/bitbucket/repo 并将所有内容推送到bitbucket: git push --mirror bitbucket 实际上,你可以从当地的回购协议中购买 2020年更新: 正如下面在的中所指出的,如果您谈论的是一个本地BitBucket服务器(

我有一个从GitHub克隆的回购协议,我想在BitBucket上镜像这个回购协议。有没有办法做到这一点?我认为回购协议中有两个来源。

您只需添加第二个远程:

git remote add bitbucket /url/to/am/empty/bitbucket/repo
并将所有内容推送到bitbucket:

git push --mirror bitbucket
实际上,你可以从当地的回购协议中购买


2020年更新:

正如下面在的中所指出的,如果您谈论的是一个本地BitBucket服务器(与BitBucket.org相反),那么您可以利用

起:

(及)

仅适用于具有活动Bitbucket数据中心许可证的客户


这里解释的方法更好


git远程设置url源--添加https://bitbucket.org/YOU/YOUR_REPO.git


git的最新版本处理同一来源中的多个URL;)

您还可以检查以下内容(从下面的链接粘贴副本)

从,您可以使用

git clone --mirror git@example.com/upstream-repository.git

cd upstream-repository.git

git push --mirror git@example.com/new-location.git
或者你可以跟随

打开终端并创建存储库的裸克隆

git clone --bare https://github.com/exampleuser/old-repository.git
cd old-repository.git
git push --mirror https://github.com/exampleuser/new-repository.git
镜像推送到新存储库

git clone --bare https://github.com/exampleuser/old-repository.git
cd old-repository.git
git push --mirror https://github.com/exampleuser/new-repository.git
删除在步骤1中创建的临时本地存储库

cd ..
rm -rf old-repository.git

您不再需要创建这些镜像链接。Bitbucket提出了智能镜像的概念,它可以实时同步到镜像服务器

更多阅读这里


希望这有帮助

对于Bitbucket服务器,您可以使用ScriptRunner


充分披露:我为他们工作:)

好的一点(+1)我已将此功能包含在我的回答中,以提高可见性。BitBucket服务器智能镜像功能仅适用于具有活动BitBucket数据中心的客户license@V-Q-安圭延谢谢你,说得好。我已经在答案中加入了你的评论,以获得更高的可视性。很好,甚至比我的答案更中肯!向上投票。有点让我想起GitHub操作;)