Mercurial:abort:没有提供用户名(参见"hg help config")

Sne*_*hal 162 configuration mercurial

我已经添加了存储库,在提交时我得到了错误

error:  abort: no username supplied (see "hg help config") 
Run Code Online (Sandbox Code Playgroud)

我也没有在我的本地获得Mercurial.ini文件.有谁知道如何在Fedora上解决这个错误?

cjg*_*cjg 179

将hgrc放在repo中的.hg目录中,或者将.hgrc(hgrc for Windows)文件放在你的home目录中(然后它覆盖你所有的项目)在文件中你应该写

[ui]
username = Your Name <your@mail>
Run Code Online (Sandbox Code Playgroud)

  • 从 [Mercurial 3.0](http://mercurial.selenic.com/downloads) 开始,“hg config -e”命令可能会有所帮助,该命令会使用您的主配置文件打开编辑器。有关更多选项,请参阅“hg help -c config”。 (2认同)

nco*_*boy 55

在Windows上,将读取以下配置文件:

- "<repo>\.hg\hgrc"
- "%USERPROFILE%\.hgrc"
- "%USERPROFILE%\Mercurial.ini"
- "%HOME%\.hgrc"
- "%HOME%\Mercurial.ini"
- "C:\Mercurial\Mercurial.ini"
- "HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial"
- "<install-dir>\Mercurial.ini"
Run Code Online (Sandbox Code Playgroud)

在Unix上,读取这些文件:

- "<repo>/.hg/hgrc"
- "$HOME/.hgrc"
- "/etc/mercurial/hgrc"
- "/etc/mercurial/hgrc.d/*.rc"
- "<install-root>/etc/mercurial/hgrc"
- "<install-root>/etc/mercurial/hgrc.d/*.rc"
Run Code Online (Sandbox Code Playgroud)

在上面的其中一个文件中包含以下内容:

[ui]
username = Your Name <your@mail>
Run Code Online (Sandbox Code Playgroud)

  • 它确实,[ui]用户名=你的名字告诉如何指定用户名. (3认同)

Zom*_*eep 19

简单的答案 - 在你的.hg文件夹中,在那里创建一个名为.hgrc的文件,添加以下内容(检查hg help config确切的语法)

[ui]
username = forename surname <forename.surnamce@email.com>
verbose = True
Run Code Online (Sandbox Code Playgroud)

并保存.应该现在就行.请注意,不需要verbose = True,但我将其包含在内,因为它列在帮助内容中

(这是来自内存,但hg help config会告诉你正确的文件名和语法)

  • 最好将username放在user-global~/.hgrc文件中,而不是per-repo文件中. (4认同)

Nik*_*iko 16

运行hg config --edit (在linux debianwindows上测试它在hg 3.1中)它将创建(如果不存在)并打开带有文本的文件:

# example config (see "hg help config" for more info)

[ui]
# name and email, e.g.
# username = Jane Doe <jdoe@example.com>
username = 

[extensions]
# uncomment these lines to enable some popular extensions
# (see "hg help extensions" for more info)
# pager =
# progress =
# color =  
Run Code Online (Sandbox Code Playgroud)

填写"用户名"字段并保存文件