2011-02-11 13 views
11

Uczę się używać Mercurial, a jego krzywa uczenia się jest całkiem prosta. Ale jednym z moich problemów jest to, że nie mogę dodać pliku .hgignore do folderu Mercurial. Okna (7) nie pozwala mi tego zrobić, a kiedy uruchomić polecenieJak dodać .hgignore do mojego folderu Mercurial?

hg add .hgignore

, zwraca błąd:

the system cannot find the specified file.

Jak mogę utworzyć/dodać ten plik?

+1

[TortoiseHg] (http://tortoisehg.bitbucket.org/) dodaje go automatycznie podczas tworzenia repozytorium. –

Odpowiedz

15

Execute

touch .hgignore

lub

echo "" > .hgignore

w potrzebnej katalogu

8

Tworzenie go z linii poleceń

echo syntax: glob > .hgignore 
2

Nie musisz dodawać go do katalogu Mercurial. Powinieneś umieścić .hgignore w katalogu głównym repozytorium.

The Mercurial system uses a file called .hgignore in the root directory of a repository to control its behavior when it searches for files that it is not currently tracking

Można również skonfigurować globalne pliki .hgignore:

In addition, a Mercurial configuration file can reference a set of per-user or global ignore files. See the hgrc(5) man page for details of how to configure these files. Look for the "ignore" entry in the "ui" section.

i tam można zobaczyć instrukcje, aby określić plik w mercurial.ini ignorować (lub hgrc) file:

ignore A file to read per-user ignore patterns from. This file should be in the same format as a repository-wide .hgignore file. This option supports hook syntax, so if you want to specify multiple ignore files, you can do so by setting something like ignore.other = ~/.hgignore2. For details of the ignore file format, see the hgignore(5) man page.

+0

Nie wspomniałem, że "folder Mercurial" to folder .hg w moim kodzie źródłowym – Vimvq1987

+2

Zrozumiałem to. Mówię, że .hgignore nie należy umieszczać w folderze .hg, należy go umieścić w folderze głównym repozytorium, tj. Powinien być umieszczony w tym samym folderze, w którym znajduje się twój kod źródłowy. –

+0

Sprawdź swój punkt. Nie wiedziałem o tym. Dziękuję :) – Vimvq1987

Powiązane problemy