git archive : export-ignore, ignoring directories

JuanPablo picture JuanPablo · Feb 17, 2014 · Viewed 7.8k times · Source

I have a git repository with this .gitattributes:

my_script.py export-subst
Makefile export-ignore
README.md export-ignore
.gitattributes export-ignore
.gitignore export-ignore
hooks/ export-ignore
tests/ export-ignore
*.pyc export-ignore

but when I make:

git archive HEAD | tar -x -C ../archive_dir

in the archive_dir directory, I get the directories hooks and tests:

 ls ../archive_dir/
 hooks/  my_script.py tests/

Why?

My git version is 1.7.9.

Answer

JuanPablo picture JuanPablo · Feb 17, 2014

I removed the / in the directories, this fixed the problem

my_script.py export-subst
Makefile export-ignore
README.md export-ignore
.gitattributes export-ignore
.gitignore export-ignore
hooks export-ignore
tests export-ignore
*.pyc export-ignore

I find the solution in a answer to a similar question: git ignoring .gitattributes pattern