Repository: cargo-generate/cargo-generate (Rust)

Issue:
Despite using --init option, it's still trying to initialize a git repository
**Describe the bug**
cargo-generate with `--init` is still trying to initialize a git repository. I wanted to use my already existing Github repository.

**make sure you**
- [x] I'm on the latest rust version `rustup update`
- [x] I'm on the latest cargo-generate version `cargo install cargo-generate`

**To Reproduce**
Steps to reproduce the behavior:
1. `git clone` my already existing repository, enter the directory.
2. `cargo generate --init --git https://github.com/aya-rs/aya-template`
3. Answered all the prompt questions.
4. See error:

```
Error: ⚠️   File already exists: /home/vadorovsky/repos/aya-btf-maps/.git/index
```

**Expected behavior**
Because of using `--init` option, I would expect cargo-generate to not try to create any files in `.git`.

**Screenshots**
![cargo-generate-git-error](https://user-images.githubusercontent.com/34685103/193748983-514b7803-75e9-4c90-a3c3-1eb74cac9b5a.png)


**Desktop (please complete the following information):**
 - OS: Manjaro Linux
 - Version: rolling releasse
 - Build tools: gcc
 - Shell: nushell
 - `rustc --version`: rustc 1.64.0 (a55dd71d5 2022-09-19)
 - `cargo generate --version`: cargo-generate 0.16.0

**Additional context**



Discussion:
This bug can be tested with the following script:

```
#!/bin/sh
set -xe

cargo build

rm -rf test
mkdir test
git -C test init
sh -c 'cd test && ../target/debug/cargo-generate generate --git https://github.com/rustwasm/wasm-pack-template --name=foo --init'
```



Patch:
diff --git a/src/lib.rs b/src/lib.rs
index bb17b1f0..fef820f3 100755
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -353,6 +353,9 @@ pub(crate) fn copy_dir_all(
             let entry_type = src_entry.file_type()?;
 
             if entry_type.is_dir() {
+                if filename == ".git" {
+                    continue;
+                }
                 let dst_path = dst.as_ref().join(filename);
                 check_dir_all(src_entry.path(), dst_path, overwrite)?;
             } else if entry_type.is_file() {


Test patch:
diff --git a/tests/integration/basics.rs b/tests/integration/basics.rs
index 73b47655..47c8733f 100644
--- a/tests/integration/basics.rs
+++ b/tests/integration/basics.rs
@@ -391,6 +391,36 @@ version = "0.1.0"
     Ok(())
 }
 
+#[test]
+fn it_can_generate_into_existing_git_dir() -> anyhow::Result<()> {
+    let template = tmp_dir()
+        .file(
+            "Cargo.toml",
+            r#"[package]
+name = "{{project-name}}"
+description = "A wonderful project"
+version = "0.1.0"
+"#,
+        )
+        .init_git()
+        .build();
+    let dir = tmp_dir().file(".git/config", "foobar").build();
+    binary()
+        .arg("generate")
+        .arg("--git")
+        .arg(template.path())
+        .arg("--name")
+        .arg("my-proj")
+        .arg("--init")
+        .current_dir(dir.path())
+        .assert()
+        .success()
+        .stdout(predicates::str::contains("Done!").from_utf8());
+    assert!(dir.read("Cargo.toml").contains("my-proj"));
+    assert!(dir.read(".git/config").contains("foobar"));
+    Ok(())
+}
+
 #[test]
 fn it_can_generate_at_given_path() -> anyhow::Result<()> {
     let template = tmp_dir()