2017-10-13 54 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 --