mercurial - 使用 Mercurial 为现有项目创建新的远程存储库

标签 mercurial ssh hgrc

我有一个 version.2 的项目,我必须开始研究它以开发一个新的 version.3 。
我想在远程服务器(即 mercurial-server)上创建一个新的存储库,以便我的团队成员可以访问该存储库。我的本地机器上有我的项目文件。

我有两个关心的问题:

  • 我如何在 /home/hg/repositories/private/project3 中创建它(假设新的 repo 名称将是 project3)远程 mercurial-server 与我的项目文件。我应该遵循哪些步骤来做到这一点。
  • 我如何创建访问权限(用户名/密码),以便我的团队可以在 http://dev.myproject.com/private/project3 上访问此存储库.

  • 注: /home/hg/repositories/ http://dev.myproject.com/ 的默认值而且我没有版本 2 的 repo (我猜是不可能克隆的!)

    最佳答案

    如果不安装额外的服务器端软件,您的团队将需要该盒子上的 ssh 帐户。我假设你有一个并且你可以为你的 friend 创建它们。如果您没有这样的设置,最好只使用 bitbucket,它是免费的并且提供 ssh 和 ftp 访问。

    此外,您不会说您的 project2 是否已经在 Mercurial 控制之下,所以我假设它不是。

    要创建远程存储库,您可以执行以下操作 在您的本地机器上 :

    hg init project3   # <-- creates a new empty respository
    cp ALL_THE_PROJECT3_FILES_YOU_WANT project3  # <--- put the files you want into project3
    cd project3   # <-- go into your local project3 repository
    hg addremove   # <-- LOCALLY add the files you copied in
    hg commit -m "initial commit copied in project2"  # <-- LOCALLY commit the files
    cd ..   # <---- go up a directory
    hg clone project3 ssh://yourusername@dev.myproject.com//home/hg/repos/project3  # clone the repo over to the server
    

    然后您的队友可以使用以下方法进行克隆:
    hg clone ssh://theirusername@dev.myproject.com//home/hg/repos/project3
    

    以下是您在实现此功能的过程中可能会意外搞砸的一些事情:
  • 你的 friend 需要ssh账号
  • 您的 friend 帐户需要读/写访问权限 /home/hg/repos

  • 请注意,所有克隆都是通过 ssh 进行的。设置 HTTP 更难,而且可能不是您需要做的事情。

    说真的,只需使用 bitbucket。

    关于mercurial - 使用 Mercurial 为现有项目创建新的远程存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11668065/

    相关文章:

    Mercurial:两名 Windows 开发人员,我的 PC 上的中央存储库。我应该在中央存储库中工作还是从中克隆?

    mercurial - 查看特定的分支?

    python - 如何为不同分支中的 Django ROOT_URLCONF 设置设置正确的值

    java - 我无法通过 ssh 连接到 mysql,我不知道为什么使用 Java

    mercurial - 如何获取远程服务器hg路径?

    mercurial - 在推送到 hgweb 服务器时创建远程书签

    mercurial - 如何配置 Mercurial 进行推送而不通过 ssh 询问我的密码?

    version-control - Mercurial 错误。不在根下

    ssh - 将 SSH key 部署到服务器

    linux - SSH 配置未对 github enterprise 和 github.com 进行身份验证