2010-03-19 29 views
161

我已經加入資料庫,並在提交我得到錯誤的水銀:中止:沒有提供的用戶名(見「汞幫助配置」)

error: abort: no username supplied (see "hg help config") 

我不會在我的本地獲得Mercurial.ini文件的時間以及。有誰知道我可以如何解決Fedora上的這個錯誤?

+2

Mercurial.ini文件是Windows上的用戶配置文件。在Fedora上它可能是〜/ .hgrc – hwiechers 2010-03-20 10:02:37

回答

19

答案很簡單 - 在你.hg文件夾,創建一個在那裏名爲.hgrc 文件,添加以下內容(檢查hg help config的確切語法)

[ui] 
username = forename surname <[email protected]> 
verbose = True 

並保存。現在應該工作。請注意,詳細=真不是必需的,但我把它,因爲它是在幫助內容

(這是從內存,但hg help config會告訴你正確的文件名和語法)上市

+0

爲什麼要改變爲冗長? – tonfa 2010-03-19 14:54:25

+0

正如我在答案中所說的那樣,它不是必需的,但是我把它放在了'hg help config'輸出中。只是在一致性的答案。 :) – ZombieSheep 2010-03-19 15:10:19

+4

最好將用戶名放在您的user-global〜/ .hgrc文件中,而不是放在每個回購文件中。 – 2010-11-13 19:58:04

176

要麼把一個hgrc在您的回購協議.hg目錄或把.hgrc(hgrc適用於Windows)在你的主目錄文件(然後它涵蓋了所有的項目) 在該文件中,你應該寫

[ui] 
username = Your Name <[email protected]> 
+1

在unix或cygwin中您的homedir中的文件以點開頭:.hgrc – neves 2013-10-18 22:19:23

+0

是的,gregm將它編輯爲windows文件名,所以我現在澄清它,涵蓋了兩者。 – cjg 2013-10-22 13:07:43

+1

從[Mercurial 3.0](http://mercurial.selenic.com/downloads)可能對'hg config -e'命令有幫助,該命令用您的主配置文件打開編輯器。有關更多選項,請參閱'hg help -c config'。 – santiagopim 2014-05-09 11:47:06

54

在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" 

在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" 

包括在上述這些文件的下列操作之一:

[ui] 
username = Your Name <[email protected]> 
+3

-1:這不回答問題。 – 2010-05-03 14:44:36

+3

它呢,[ui] username =你的名字告訴你如何指定用戶名。 – 2012-01-04 07:13:11

+0

這真的不是因爲它沒有說哪個文件應該存儲用戶名,也不解釋爲什麼它沒有或沒有要求首先註冊用戶名。 – anon58192932 2012-10-22 02:41:50

1

放文件.hgrc在$ HOME或home/user的

2

確保當前用戶擁有hgrc文件或以其他方式擁有正確的權限。

14

運行汞柱配置--edit(在汞柱3.1都測試了的Linux Debian的窗戶) 它將創建(如果不存在),打開一個文件與文本:

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

[ui] 
# name and email, e.g. 
# username = Jane Doe <[email protected]> 
username = 

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

填寫「用戶名」字段並保存文件

+2

'unknown command'config'' – lazycommit 2014-11-13 06:10:18

+0

@lazycommit,這是你的hg版本和操作系統?我在linux debian和windows 7中檢查了3.1.1 - 它在那裏工作。也許你的hg比較老。 – 2014-11-26 08:55:43

+0

2.8.2是的,它是舊的) – lazycommit 2014-12-08 14:57:16

相關問題