银河

SKYIV STUDIO

  博客园 :: 首页 :: 博问 :: 闪存 :: :: :: 订阅 订阅 :: 管理 ::
  268 随笔 :: 2 文章 :: 2616 评论 :: 140万 阅读
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

概述

Tower Joo 在“你使用源码管理工具吗?”中推荐 Mercurial 分布式源码管理工具和提供 code hosting 服务的 bitbucket.org 网站。该网站的用户分为 Free、Amateur、Pro、Large 和 Team 五个级别。其中免费的 Free 级别提供 1 个 private 和任意多个 public 的代码库(repository),可用磁盘空间为 150 MB。

另外,Google Code 网站也提供免费的 code hosting 服务,她支持 SubversionMercurial 两种源码管理工具。但是,我总觉得 Google Code 用起来不如 bitbucket.org 顺手。 :)

安装 Mercurial

Ubuntu 操作系统: 使用 $ sudo apt-get install mercurial 命令安装。

Windows 操作系统: 到 Mercurial SCM 下载并安装。

配置 Mercurial

在操作系统中你自己的 HOME 目录下创建一个 .hgrc 文件,内容如下:

(注:Windows 操作系统中的 HOME 目录可使用 C> echo %UserProfile% 命令获得。)

# This is a Mercurial configuration file.
[ui]
username = ben.skyiv

使用 Mercurial

bitbucket.org 网站注册一个用户,我注册的 username 是: ben.skyiv

然后就可以点击网页右上角的“Create new”按钮来创建一个新的代码库(repository),比如叫做:  BigInteger 。

然后就可以接着干活了:

$ cd ~/Projects
$ hg clone https://ben.skyiv@bitbucket.org/ben.skyiv/biginteger/  BigInteger
$ cd BigInteger
$ (在这个目录下干些活儿,也可以把原来现成的东东拷贝到这个目录下)
$ hg add
$ hg ci -m "Init"
$ hg push

这样就 OK 了。

使用 SSH

按照 UsingSSH 中要求在 bitbucket.org 网站中的 Account 页面设置好 SSH 公钥(Public key)。注意,这相当于在你的 Account 中开了一扇带锁的门,而你的 SSH 私钥就是这扇门的钥匙。所以,请务必保管好你的 SSH 私钥。然后就可以用

$ hg clone ssh://hg@bitbucket.org/ben.skyiv/biginteger/  BigInteger

代替上一节的 hg clone 命令,这样,在执行 hg push 命令时就不需要输入密码了(当然,这取决于你的 SSH 密钥的设置)。

注:Windows 操作系统请参阅“对话 UNIX: 在 Windows 上使用 Cygwin”,安装 CygwinOpenSSH。然后在 .hgrc 文件的 [ui] 节中加入以下语句:ssh = C:\cygwin\bin\ssh -C

进一步的阅读

请务必看看:A tour of Mercurial: the basicsUnderstanding Mercurial

还可以看看:hgrc: configuration files for Mercurial

posted on   银河  阅读(1565)  评论(3编辑  收藏  举报
编辑推荐:
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
阅读排行:
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· Ollama——大语言模型本地部署的极速利器
· [AI/GPT/综述] AI Agent的设计模式综述
点击右上角即可分享
微信分享提示