本文介绍了.hg/hgrc 中未指定 hg 推送错误和用户名.不会使用钥匙圈的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做了以下事情:

hg clone ...somelink.to.repo.in.hg...千兆

hg clone ...somelink.to.repo.in.hg... Giga

cd 千兆

ls (...它显示 giga.txt 文件存在于 Giga 目录中)

ls (...it shows me giga.txt file exist in Giga directory)

vi giga.txt (...做了一些更改..)

vi giga.txt (...made some changes..)

hg 提交 -m "字节"

hg commit -m "byte"

hg out(出现以下错误)

hg out (got the following error)

** unknown exception encountered, details follow
** report bug details to http://mercurial.selenic.com/bts/
** or [email protected]
** Mercurial Distributed SCM (version 1.5)
** Extensions loaded: acl, bugzilla, children, churn, color, convert, extdiff, fetch, gpg, graphlog, hgcia, hgk, highlight, interhg, keyword, mercurial_keyring, mq, notify, pager, patchbomb, progress, purge, rebase, record, relink, schemes, share, transplant, zeroconf
Traceback (most recent call last):
  File "/usr/bin/hg", line 27, in <module>
    mercurial.dispatch.run()
  File "/usr/lib/python2.6/site-packages/mercurial/dispatch.py", line 16, in run
    sys.exit(dispatch(sys.argv[1:]))
  File "/usr/lib/python2.6/site-packages/mercurial/dispatch.py", line 30, in dispatch
    return _runcatch(u, args)
  File "/usr/lib/python2.6/site-packages/mercurial/dispatch.py", line 47, in _runcatch
    return _dispatch(ui, args)
  File "/usr/lib/python2.6/site-packages/mercurial/dispatch.py", line 466, in _dispatch
    return runcommand(lui, repo, cmd, fullargs, ui, options, d)
  File "/usr/lib/python2.6/site-packages/mercurial/dispatch.py", line 336, in runcommand
    ret = _runcommand(ui, options, cmd, d)
  File "/usr/lib/python2.6/site-packages/mercurial/extensions.py", line 128, in wrap
    return wrapper(origfn, *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/hgext/pager.py", line 66, in pagecmd
    return orig(ui, options, cmd, cmdfunc)
  File "/usr/lib/python2.6/site-packages/mercurial/dispatch.py", line 517, in _runcommand
    return checkargs()
  File "/usr/lib/python2.6/site-packages/mercurial/dispatch.py", line 471, in checkargs
    return cmdfunc()
  File "/usr/lib/python2.6/site-packages/mercurial/dispatch.py", line 465, in <lambda>
    d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
  File "/usr/lib/python2.6/site-packages/mercurial/util.py", line 401, in check
    return func(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/mercurial/extensions.py", line 116, in wrap
    util.checksignature(origfn), *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/mercurial/util.py", line 401, in check
    return func(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/hgext/color.py", line 352, in nocolor
    return orig(*args, **opts)
  File "/usr/lib/python2.6/site-packages/mercurial/util.py", line 401, in check
    return func(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/mercurial/extensions.py", line 116, in wrap
    util.checksignature(origfn), *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/mercurial/util.py", line 401, in check
    return func(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/hgext/mq.py", line 2648, in mqcommand
    return orig(ui, repo, *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/mercurial/util.py", line 401, in check
    return func(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/mercurial/extensions.py", line 116, in wrap
    util.checksignature(origfn), *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/mercurial/util.py", line 401, in check
    return func(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/hgext/graphlog.py", line 365, in graph
    return orig(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/mercurial/util.py", line 401, in check
    return func(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/mercurial/commands.py", line 2275, in outgoing
    other = hg.repository(cmdutil.remoteui(repo, opts), dest)
  File "/usr/lib/python2.6/site-packages/mercurial/hg.py", line 82, in repository
    repo = _lookup(path).instance(ui, path, create)
  File "/usr/lib/python2.6/site-packages/mercurial/httprepo.py", line 271, in instance
    inst.between([(nullid, nullid)])
  File "/usr/lib/python2.6/site-packages/mercurial/httprepo.py", line 190, in between
    d = self.do_read("between", pairs=n)
  File "/usr/lib/python2.6/site-packages/mercurial/httprepo.py", line 134, in do_read
    fp = self.do_cmd(cmd, **args)
  File "/usr/lib/python2.6/site-packages/mercurial/httprepo.py", line 85, in do_cmd
    resp = self.urlopener.open(req)
  File "/usr/lib/python2.6/urllib2.py", line 397, in open
    response = meth(req, response)
  File "/usr/lib/python2.6/urllib2.py", line 510, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python2.6/urllib2.py", line 429, in error
    result = self._call_chain(*args)
  File "/usr/lib/python2.6/urllib2.py", line 369, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.6/urllib2.py", line 855, in http_error_401
    url, req, headers)
  File "build/bdist.linux-i686/egg/mercurial_keyring.py", line 339, in basic_http_error_auth_reqed
  File "/usr/lib/python2.6/urllib2.py", line 833, in http_error_auth_reqed
    return self.retry_http_basic_auth(host, req, realm)
  File "/usr/lib/python2.6/urllib2.py", line 836, in retry_http_basic_auth
    user, pw = self.passwd.find_user_password(realm, host)
  File "build/bdist.linux-i686/egg/mercurial_keyring.py", line 333, in find_user_password
  File "build/bdist.linux-i686/egg/mercurial_keyring.py", line 184, in find_auth
  File "build/bdist.linux-i686/egg/mercurial_keyring.py", line 67, in get_http_password
  File "/usr/local/lib/python2.6/site-packages/keyring/core.py", line 37, in get_password
    return _keyring_backend.get_password(service_name, username)
  File "/usr/local/lib/python2.6/site-packages/keyring/backend.py", line 143, in get_password
    items = gnomekeyring.find_network_password_sync(username, service)
gnomekeyring.IOError

我的 ~/.hgrc(OpenSUSE 机器)

[ui]
username=c123456 <[email protected]>

[extensions]
mercurial_keyring = /root/mercurial_keyring.py

#[trusted]
#users = *
#groups = *

[extensions]
acl =
bugzilla =
children =
churn =
color =
convert =
eol = !
extdiff =
factotum = !
fetch =
gpg =
graphlog =
hgcia =
hgcr-gui-qt = !
hgk =
highlight =
interhg =
keyword =
largefiles = !
mercurial_keyring =
mq =
notify =
pager =
patchbomb =
perfarce = !
progress =
projrc = !
purge =
rebase =
record =
relink =
schemes =

............等等

............etc

我的本​​地仓库(在 OpenSuse 克隆文件夹中 - 内部:/Giga/.hg/hgrc)是:

My local repository(on OpenSuse cloned folder - inside: /Giga/.hg/hgrc) is:

[paths]
default = http://the.hg.server.com/hg/TestHgRepo1/
myrepo = http://the.hg.server.com/hg/TestHgRepo1/

[auth]
myrepo.schemes = http https
myrepo.prefix = the.hg.server.com/hg
myrepo.username = c123456

我尝试了所有方法,但这个 Keyring 东西不起作用.每次我都会得到提示:


I tried everything but this Keyring thing is not working. I get prompt everytime I do:

  • 出来

hg 推

等 hg 操作,但我做的时候没有

etc hg operation but not when I do

hg 提交

有人可以告诉我我在这里想念什么.在 Windows 上使用 TortoiseHg 尝试了相同的练习,使用 C:...mercurial.ini(Windows 端有点像 unix ~/.hgrc 文件).. 并更新/确保本地存储库克隆文件夹的 ../clonedfolder/.hg/hgrc 文件包含类似的 [auth] ..3 行,但在 Linux OpenSUSE 和 Windows 上使用 TortoiseHg 的 Mercurial 无法使用密钥环.

Can someone please tell what the heck I'm missing here. Tried the same excercise on Windows with TortoiseHg, with C:...mercurial.ini (Windows side kinda of unix ~/.hgrc file).. and updated/made sure local repository cloned folder's ../clonedfolder/.hg/hgrc file contains the similar [auth] ..3 lines but Mercurial on Linux OpenSUSE and on Windows using TortoiseHg is not working with keyring.

它提示我再次输入用户凭据 n :((

It's prompting me for entering user credentials again n again :((

有人可以纠正我该怎么做才能解决这个问题.

can someone pls correct me on what should I do to get this resolved.

推荐答案

如果在 mercurial 中多次提示用户凭据.设置 Mercurial_Keyring 然后

if prompted multiple times for user credentials in mercurial. Setup Mercurial_Keyring and then

这个问题来了,没有人能简单地解释一下.

this question comes which nobody explained in an easy way.

???如果我使用 servername、servername 的 IP 或 servername 的 FQDN,如何使 [auth] xx.prefix = servername/hg_or_something 对 servername/hg 位置下的所有存储库起作用?

??? how to make the [auth] xx.prefix = servername/hg_or_something work for all repositories under servername/hg location either if I use servername, servername's IP or servername's FQDN ?

最终答案:Arun • 2 分钟前 -

Final ANSWER: Arun • 2 minutes ago −

好的,我把它放在~/.hgrc(Linux/Unix -home 目录的.hgrc 隐藏文件)或Windows 用户的%UserProfile%/mercurial.ini 或%HOME%/mercurial.ini 文件中.

OK, I put this in ~/.hgrc (Linux/Unix -home directory's .hgrc hidden file) or Windows users %UserProfile%/mercurial.ini or %HOME%/mercurial.ini file.

[auth]
default1.schemes = http https
default1.prefix = hg_merc_server/hg
default1.username = c123456

default2.schemes = http https
default2.prefix = hg_merc_server.company.com/hg
default2.username = c123456

default3.schemes = http https
default3.prefix = 10.211.222.321/hg
default3.username = c123456

现在,我可以使用任一服务器/IP/服务器的 FQDN 结帐.

Now, I can checkout using either Server/IP/Server's FQDN.

这篇关于.hg/hgrc 中未指定 hg 推送错误和用户名.不会使用钥匙圈的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-19 17:45