例说hg(五)————创建repository

    有很多网站提供了免费的Mercurial版本库托管,最有名的要数Bitbucket 和 Google Code,由于博主使用的是BB,在此以BB为例来说明一下使用Mercurial来创建repository。 在此建议看官注册一个Bitbucket账号(Bitbucket注册)。

    Bitbucket为我们提供了一个很友好的操作面板,当你登录后,就会看到下面的界面:

 

    点击右边的Create repository或者蓝色部分的Create,就会出现下面面板:

      填写对应信息,完成repository的创建:

      1.填写repos的名称。

      2.对repos的描述。

      3.选择repos的访问权限,如果想私有,就勾选Access Level。

      4.Forking 默认。

      5.Repository type 选择Mercurial,我们这里练习Mercurial的使用

      6.Issue tracking 和 Wiki也勾选吧,以后追踪bug,写说明有用。

      7.选择你工程的语言类型。

      8.点击Create repository 创建我们的工程。(我创建testHg为私有的测试Repos)

 

    点击Clone,获取仓库的克隆地址:

 

     复制地址到终端,获取刚才创建的repository:

 

c_wspace$ hg clone https://RobinLau@bitbucket.org/RobinLau/testhg
http authorization required
realm: Bitbucket.org HTTP
user: RobinLau
password: 
destination directory: testhg
no changes found
updating to branch default
0 files updated, 0 files merged, 0 files removed, 0 files unresolved

 

    到此为止,我们的repository创建成功。

    我们来看一下创建的名为testhg的repos的目录结构(下面是tree的结果,.hg下是隐藏文件,hgrc是hg的配置文件):

testhg$ tree -R .hg/
.hg/
├── 00changelog.i
├── branch
├── dirstate
├── hgrc
├── requires
└── store

1 directory, 5 files


       为repos添加README,并且添加一个测试文件:

 

 

testhg$ ls
README  testhg.c


       我们把添加的文件push到BB的仓库中:

 

 

robin@ubuntu:~/workspace/c_wspace/testhg$ hg add 
adding README
adding testhg.c
robin@ubuntu:~/workspace/c_wspace/testhg$ hg commit -u RobinLau -m "test hg"
robin@ubuntu:~/workspace/c_wspace/testhg$ hg push 
pushing to https://RobinLau@bitbucket.org/RobinLau/testhg
http authorization required
realm: Bitbucket.org HTTP
user: RobinLau
password: 
searching for changes
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 1 changesets with 2 changes to 2 files

 

 

        我们查看一下BB的状态:

我们可以看到,testhg.c和README到我们仓库里了,README的内容也显示在了我们的面板中。

 

HG在windows上的使用方法(待续)

 

 

 

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值