将 HG 项目从 Bitbucket 镜像到 Github

发布于 2024-08-29 14:39:49 字数 58 浏览 8 评论 0原文

是否有一个有效的工作流程来将主要使用 Hg 托管在 bitbucket 上的项目镜像到 github?

Is there an efficient workflow to mirror a project that is mainly hosted on bitbucket using Hg, to github?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

浅黛梨妆こ 2024-09-05 14:39:49

您可以使用诸如 hg-git 至:

  • 在您有权推送访问的地方设置一个 Git 存储库,
  • 然后从您的项目中运行 hg push [path]。例如:
$ cd hg-git # (a Mercurial repository)
$ hg bookmark -r default master # make a bookmark of master for default, so a ref gets created
$ hg push git+ssh://[email protected]/schacon/hg-git.git
$ hg push

这会将我们所有的 Mercurial 数据转换为 Git 对象并将它们推送到 Git 服务器。
您还可以将该路径放入 .hg/hgrc[paths] 部分,然后按名称推送到该路径。

hg-git

You could use a tool like hg-git to:

  • setup a Git repository somewhere that you have push access to,
  • and then run hg push [path] from within your project. For example:
$ cd hg-git # (a Mercurial repository)
$ hg bookmark -r default master # make a bookmark of master for default, so a ref gets created
$ hg push git+ssh://[email protected]/schacon/hg-git.git
$ hg push

This will convert all our Mercurial data into Git objects and push them up to the Git server.
You can also put that path in the [paths] section of .hg/hgrc and then push to it by name.

hg-git

心清如水 2024-09-05 14:39:49

如果您将 Mercurial 用于项目,您可以快速轻松地为项目创建 git 镜像,以便 git 用户可以做出贡献。我在 GitHub 上创建了一个有关使用 hg-git 管理 Mercurial 镜像的教程。

它涵盖了如何开始使用 GitHub 帐户、如何将项目从 Mercurial 推送到 GitHub,以及如何接受来自 GitHub 的贡献(拉取请求)。以下是博客文章的链接:http:// /hgtip.com/tips/advanced/2009-11-09-create-a-git-mirror/ 存档于 http://web.archive.org/web/20100811223113/http:// hgtip.com/tips/advanced/2009-11-09-create-a-git-mirror/

If you use Mercurial for a project you can quickly and easily make a git mirror of your project so that git users can contribute. I created a tutorial about using hg-git to manage Mercurial mirrors on GitHub.

It covers how to get started with a GitHub account, how to push up a project from Mercurial to GitHub, and how to accept contributions (pull requests) from GitHub. Here's a link to the blog post: http://hgtip.com/tips/advanced/2009-11-09-create-a-git-mirror/ archived at http://web.archive.org/web/20100811223113/http://hgtip.com/tips/advanced/2009-11-09-create-a-git-mirror/

╭ゆ眷念 2024-09-05 14:39:49

'git-remote-hg'是来自 Git 项目的半官方 Mercurial 桥,安装后,它允许您克隆、获取和推送到 Mercurial 存储库,就像它们是 Git 存储库一样:

添加 git-remote-hg 到您的 bin 路径。然后你可以按照github上提到的镜像

git clone --mirror  hg::https://bitbucket_repo

然后,最后进入您的克隆存储库

git remote set-url --push origin https://github.com/exampleuser/mirrored

,同步您的镜像

git fetch -p origin
git push --mirror

'git-remote-hg' is the semi-official Mercurial bridge from Git project, once installed, it allows you to clone, fetch and push to and from Mercurial repositories as if they were Git ones:

Add git-remote-hg to your bin path. Then you can mirror as mentioned on github.

git clone --mirror  hg::https://bitbucket_repo

then, go into your cloned repo

git remote set-url --push origin https://github.com/exampleuser/mirrored

finally, sync your mirror

git fetch -p origin
git push --mirror
蓝天 2024-09-05 14:39:49

截至 2013 年 7 月,出现了 BitSyncHub Web 服务,用于通过 BitBucket 接收后挂钩自动执行此过程。不过,您需要授予服务对 GitHub 存储库的写入权限(添加 bitsynchub 作为贡献者)。

As of July 2013 there is BitSyncHub a web service for automating this process via a BitBucket post-receive hook. You will need to grant the service write permission to your GitHub repository though (add bitsynchub as a contributor).

一笔一画续写前缘 2024-09-05 14:39:49

我是从 2019 年 2 月开始报告的。我刚刚遇到了这个问题,按照 @vonc 的建议使用 hg-git,并填补了一些缺失的步骤以使其正常工作。在这里我将提供更详细的指南:

  1. 通过在某处克隆其 存储库 来安装 hg-git使 ~/.hgrc 文件中的“扩展”部分看起来像这样:
[extensions]
hggit = [path-to]/hg-git/hggit

我在源存储库中找到了最新的安装说明:https://bitbucket.org/durin42/hg-git。所以请留意这一点。

  1. 安装dulwich(如果尚未安装):pip install dulwich

  2. 在 GitHub 上创建一个新的空存储库,例如 https://github.com/user/git -mirror

  3. 克隆 hg 源码仓库,并将其推送到 git 镜像:

$ hg clone https://bitbucket.org/user/hg-source
$ cd hg-source
$ hg push git+ssh://[email protected]/user/git-mirror.git

I'm reporting from Feb 2019. I just encountered this problem, followed @vonc's suggestion to use hg-git, and filled a few missing steps to make it work. Here I'll provide a more detailed guide:

  1. Install hg-git by cloning its repository somewhere and making the 'extensions' section in your ~/.hgrc file look something like this:
[extensions]
hggit = [path-to]/hg-git/hggit

I found the most up-to-date installation instructions in the source repository: https://bitbucket.org/durin42/hg-git. So keep an eye that.

  1. Install dulwich if not already: pip install dulwich.

  2. Create a new empty repository on GitHub, for example https://github.com/user/git-mirror.

  3. Clone the hg source repository, and push it to the git mirror:

$ hg clone https://bitbucket.org/user/hg-source
$ cd hg-source
$ hg push git+ssh://[email protected]/user/git-mirror.git
南街九尾狐 2024-09-05 14:39:49

另一种可用于快速转换的解决方案:https://github.com/frej/fast-export

One more available solution to quickly convert: https://github.com/frej/fast-export

维持三分热 2024-09-05 14:39:49

您可以使用 Git-hg 镜像服务 来执行此操作(包括将 GitHub 存储库镜像到 Bitbucket,或双向同步) 。

You can use the Git-hg Mirror service to do this (including mirroring a GitHub repo to Bitbucket, or syncing bidirectionally).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文