如何在Mercurial中设置我的用户名?

时间:2012-02-21 06:37:47

标签: mercurial

运行Mercurial时出现此错误:

t3@des:gem5$ hg qnew my_p.diff
abort: no username supplied (see "hg help config")

hg help config说:

The configuration files use a simple ini-file format. A configuration file
consists of sections, led by a "[section]" header and followed by "name =
value" entries:

  [ui]
  username = Firstname Lastname <firstname.lastname@example.net>
  verbose = True

但那个ini文件在哪里?

2 个答案:

答案 0 :(得分:5)

hg help config

  

默认情况下,这些文件不存在,您必须创建   适当的配置文件:全局配置如   用户名设置通常放入   “%USERPROFILE%\ mercurial.ini”或“$ HOME / .hgrc”和本地配置   被放入per-repository“/.hg/hgrc”文件中。

答案 1 :(得分:3)

假设您在Linux上,请在您的主目录或存储库目录中创建.hgrc文件,

  

dirunderhgcontrol / .hg / .hgrc

将您在问题中说明的信息(ui,username,verbose ...)添加到新文件中,然后尝试一下。