diff --git a/README.md b/README.md
index 25cc7ca..82f0e26 100644
--- a/README.md
+++ b/README.md
@@ -423,7 +423,7 @@ enyo unlink -g --unlink-all
enyo unlink -g -U
```
-###templates `enyo templates`
+#### templates `enyo templates`
```bash
Usage: enyo templates [action] [target] [options]
@@ -465,7 +465,7 @@ enyo templates add path/to/template
enyo templates install https://github.com/enyojs/moonstone-template.git
```
-### pack `enyo pack`
+#### pack `enyo pack`
```bash
Usage: enyo pack [package] [options]
diff --git a/lib/enyo/lib/init.es6 b/lib/enyo/lib/init.es6
index 2f23f94..bcb4953 100644
--- a/lib/enyo/lib/init.es6
+++ b/lib/enyo/lib/init.es6
@@ -89,6 +89,7 @@ function initTemplate ({project, template, opts, env, log}) {
let templates = getTemplates(env)
, data = templates[template]
+ , isTemplate = true
, name = opts.name || path.basename(project)
, stat
, err;
@@ -107,7 +108,7 @@ function initTemplate ({project, template, opts, env, log}) {
return false;
}
- if (stat.isDirectory()) err = fsync.copyDir(data.path, project);
+ if (stat.isDirectory()) err = fsync.copyDir(data.path, project, false, isTemplate);
else if (stat.isSymbolicLink()) err = fsync.copyLinkDir(data.path, project);
if (err) {
diff --git a/lib/util-extra.es6 b/lib/util-extra.es6
index f9045b2..98a87fa 100644
--- a/lib/util-extra.es6
+++ b/lib/util-extra.es6
@@ -137,7 +137,7 @@ defineProperty(fsync, 'ensureDir', {value: ensureDirSync, enumerable: true});
/*
This operation should be used sparingly because of its slowness and memory consumption.
*/
-function copyDirSync (dir, target, clean = false) {
+function copyDirSync (dir, target, clean = false, isTemplate) {
let err, files;
dir = resolve(dir);
@@ -171,7 +171,9 @@ function copyDirSync (dir, target, clean = false) {
let src = join(dir, files[i])
, tgt = join(target, files[i])
, stat = statSync(src);
- if (stat.isDirectory()) err = copyDirSync(src, tgt);
+ // for templates allow copying of .gitignore file, but not .git directory
+ if (isTemplate && files[i].indexOf('.gitignore') < 0 && src.indexOf('.git') > 0) continue;
+ else if (stat.isDirectory()) err = copyDirSync(src, tgt);
else if (stat.isFile()) err = copyFileSync(src, tgt);
else if (stat.isSymbolicLink()) err = copySymbolicLinkSync(src, tgt);
else {