使用hggit克隆Github仓库 - 中止:未找到仓库

13

我正尝试使用hggit在本地克隆一些Github仓库。我正在遵循教程的指示进行操作。

$ hg clone git://github.com/schacon/hg-git.git
abort: repository git://github.com/schacon/hg-git.git not found!

$ hg clone git+ssh://git@github.com/schacon/hg-git.git
abort: repository git+ssh://git@github.com/schacon/hg-git.git not found!

我知道我已经安装了hggit,因为以下命令可以正常工作

$ python -c "import hggit"
$ head -n1 `which hg`
#!/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python
$ /opt/local/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python -c "import hggit"

此外,我还有另一个在 GitHub 上使用 hg 的存储库。我忘记了最初是如何使其工作的,但我想这是一个全新的存储库,我将其推送到了 GitHub 上。在我有一个可用存储库的文件夹中,我在我的 .hg/hgrc 文件中写下了以下内容(为保护隐私而改写):

github = git+ssh://git@github.com:myname/repo.git

[ui]
username = Fname Lname <email@gmail.com>

[extensions]
hgext.bookmarks =
hggit =
当然,对于我正在尝试克隆的仓库没有hgrc文件。更新:$ hg help给出类似以下输出:
Mercurial Distributed SCM

list of commands:

 add          add the specified files on the next commit
 addremove    add all new files, delete all missing files
 annotate     show changeset information by line for each file
 archive      create an unversioned archive of a repository revision
 backout      reverse effect of earlier changeset
 bisect       subdivision search of changesets
 branch       set or show the current branch name
 branches     list repository named branches
 bundle       create a changegroup file
 cat          output the current or given revision of files
 clone        make a copy of an existing repository
 commit       commit the specified files or all outstanding changes
 copy         mark files as copied for the next commit
 diff         diff repository (or selected files)
 export       dump the header and diffs for one or more changesets
 forget       forget the specified files on the next commit
 grep         search for a pattern in specified files and revisions
 heads        show current repository heads or show branch heads
 help         show help for a given topic or a help overview
 identify     identify the working copy or specified revision
 import       import an ordered set of patches
 incoming     show new changesets found in source
 init         create a new repository in the given directory
 locate       locate files matching specific patterns
 log          show revision history of entire repository or files
 manifest     output the current or given revision of the project manifest
 merge        merge working directory with another revision
 outgoing     show changesets not found in the destination
 parents      show the parents of the working directory or revision
 paths        show aliases for remote repositories
 pull         pull changes from the specified source
 push         push changes to the specified destination
 recover      roll back an interrupted transaction
 remove       remove the specified files on the next commit
 rename       rename files; equivalent of copy + remove
 resolve      redo merges or set/view the merge status of files
 revert       restore individual files or directories to an earlier state
 rollback     roll back the last transaction (dangerous)
 root         print the root (top) of the current working directory
 serve        start stand-alone webserver
 showconfig   show combined config settings from all hgrc files
 status       show changed files in the working directory
 summary      summarize working directory state
 tag          add one or more tags for the current or given revision
 tags         list repository tags
 tip          show the tip revision

 unbundle     apply one or more changegroup files
 update       update working directory (or switch revisions)
 verify       verify the integrity of the repository
 version      output version and copyright information

additional help topics:

 config       Configuration Files
 dates        Date Formats
 patterns     File Name Patterns
 environment  Environment Variables
 revisions    Specifying Single Revisions
 multirevs    Specifying Multiple Revisions
 revsets      Specifying Revision Sets
 diffs        Diff Formats
 merge-tools  Merge Tools
 templating   Template Usage
 urls         URL Paths
 extensions   Using additional features
 subrepos     Subrepositories
 hgweb        Configuring hgweb
 glossary     Glossary

use "hg -v help" to show aliases and global options

$ hg help extensions 给出类似以下内容:

Using additional features

    Mercurial has the ability to add new features through the use of extensions. Extensions may add new commands, add options to existing commands, change the default
    behavior of commands, or implement hooks.

    Extensions are not loaded by default for a variety of reasons: they can increase startup overhead; they may be meant for advanced usage only; they may provide
    potentially dangerous abilities (such as letting you destroy or modify history); they might not be ready for prime time; or they may alter some usual behaviors of
    stock Mercurial. It is thus up to the user to activate extensions as needed.

    To enable the "foo" extension, either shipped with Mercurial or in the Python search path, create an entry for it in your configuration file, like this:

      [extensions]
      foo =

    You may also specify the full path to an extension:

      [extensions]
      myfeature = ~/.hgext/myfeature.py

    To explicitly disable an extension enabled in a configuration file of broader scope, prepend its path with !:

      [extensions]
      # disabling extension bar residing in /path/to/extension/bar.py
      bar = !/path/to/extension/bar.py
      # ditto, but no path was supplied for extension baz
      baz = !

    disabled extensions:

     acl         hooks for controlling repository access
     bookmarks   track a line of development with movable markers
     bugzilla    hooks for integrating with the Bugzilla bug tracker
     children    command to display child changesets
     churn       command to display statistics about repository history
     color       colorize output from some commands
     convert     import revisions from foreign VCS repositories into Mercurial
     eol         automatically manage newlines in repository files
     extdiff     command to allow external programs to compare revisions
     fetch       pull, update and merge in one command
     gpg         commands to sign and verify changesets
     graphlog    command to view revision graphs from a shell
     hgcia       hooks for integrating with the CIA.vc notification service
     hgk         browse the repository in a graphical way
     highlight   syntax highlighting for hgweb (requires Pygments)
     interhg     expand expressions into changelog and summaries
     keyword     expand keywords in tracked files
     mq          manage a stack of patches
     notify      hooks for sending email notifications at commit/push time
     pager       browse command output with an external pager
     parentrevspec
                 interpret suffixes to refer to ancestor revisions
     patchbomb   command to send changesets as (a series of) patch emails
     progress    show progress bars for some actions
     purge       command to delete untracked files from the working directory
     rebase      command to move sets of revisions to a different ancestor
     record      commands to interactively select changes for commit/qrefresh
     relink      recreates hardlinks between repository clones
     schemes     extend schemes with shortcuts to repository swarms
     share       share a common history between several working directories
     transplant  command to transplant changesets from another branch
     win32mbcs   allow the use of MBCS paths with problematic encodings
     win32text   perform automatic newline conversion
     zeroconf    discover and advertise repositories on the local network

更新:修复 问题在于我没有一个“$HOME/.hgrc”文件来使用扩展程序。一旦我添加了这个文件和扩展信息,一切都正常了!


hg help 命令会列出 hggit 是否已加载为扩展吗? - anton.burger
安东,我添加了来自帮助的输出。 - highBandWidth
很高兴知道问题只是因为你没有定义$HOME/.hgrc文件。 - mr.andy.peters
4个回答

8
在基于Debian的GNU/Linux发行版中,除了
$ sudo apt install mercurial-git

我需要在我的~/.hgrc文件中添加以下几行:

[extensions]
hggit = /usr/share/pyshared/hgext/git

1
谢谢你提供的“扩展”提示。这恰好也解决了我的问题。 - saeedgnu

3

以下是我在Ubuntu 14.04上的配置(参考自Mercurial-Git软件包中的/usr/share/doc/mercurial-git/README.Debian文件):

[extensions]
hgext.bookmarks =
hgext.git = 

这个需要添加的文件是:~/.hgrc

3
这里有一个想法,也许它没有完全安装。我遇到过类似的问题,发现手动编译比使用“easy_install”更好。我遇到了“dulwhich”的版本未正确安装的问题,因此事情出了问题(可能与您的情况类似)。
我在我的博客上概述了安装过程 -> http://andypeters.org/post/5607486048/hg-git-installation-woes-on-a-mac 以下是安装的快速摘要。
  1. Download. I have been using 0.7.
  2. Install dulwich. Notice the use of --pure. I'm not 100% sure what that means, but my understanding is that it is a python thing to make a different/clean install of it.

    > sudo python setup.py --pure install
    
  3. Download hg-git. I have linked to bitbucket because i assume you have mercurial working.

  4. Install hg-git

    > sudo python setup.py install
    
希望有所帮助。

1
--pure 选项可以在不使用 C 扩展的情况下构建/安装 Dulwich。请访问 http://www.samba.org/~jelmer/dulwich/docs/(搜索页面中的“0.5.02010-03-03”)获取更多信息。 - Matt Ball

2
为了在Mercurial中启用hg-git(注意' - '),您需要类似以下的内容:
[extensions]
hg-git=e:\hg-extensions\hg-git\hggit

2
根据文档,属性名称应为hggit,而不是hg-git - Matt Ball
也许“-”被忽略了,因为我使用hg-git它可以正常工作。 - sylvanaar

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接