2017-10-13 45 views
0

我的回購https://example.com/repo.git需要塗抹清潔過濾器。我嘗試以下設置之前。如何克隆需要清理/塗抹過濾器的git存儲庫?

$ git init --bare 
$ git config filter.example.required true 
$ git config filter.example.smudge "/path/to/smudge-filter.sh %f" 
$ git config filter.example.clean "/path/to/clean-filter.sh %f" 
$ git remote add master https://example.com/repo.git 
$ git pull 
fatal: This operation must be run in a work tree 

或者它是相反的嗎?克隆回購和效果後應用過濾器?

+1

'git的初始化--bare'創建一個純倉庫,裏面有沒有工作樹。 'git pull'需要工作樹。您可以刪除'--bare'來創建一個正常的存儲庫。 – ElpieKay

回答

0

正確的做法是克隆,但後來結賬:

$ git clone --no-checkout https://example.com/repo.git 
$ git config filter.example.required true 
$ git config filter.example.smudge "/path/to/smudge-filter.sh %f" 
$ git config filter.example.clean "/path/to/clean-filter.sh %f" 
$ git checkout --