tar: --exclude=".git": Cannot stat: No such file or directory
All the options need to be together before the arguments, and the -f
flag needs to precede the tar file:
tar -zcv --exclude='.git' --exclude='.gitignore' -f $NAME-$VERSION.tar.gz $NAME-$VERSION
This gives you what you want:
tar czvf $NAME-$VERSION.tar.gz $NAME-$VERSION --wildcards --exclude=.git --exclude=.gitignore