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

mah*_*ood 1 mercurial

运行Mercurial时出现此错误:

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

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
Run Code Online (Sandbox Code Playgroud)

但那个ini文件在哪里?

Laz*_*ger 5

hg help config

默认情况下这些文件不存在,您必须自己创建相应的配置文件:全局配置(如用户名设置)通常放入"%USERPROFILE%\ mercurial.ini"或"$ HOME/.hgrc",本地配置为放入per-repository"/.hg/hgrc"文件.