Repository: dbt-labs/dbt-core

Issue:
dbt init is creating outdated config-version file 0.17.0-b1
### Describe the bug
out of interest installed 0.17.0-b1, running `dbt init` to get an idea on config-version: 2 changes still produces showed a v1 config file.

### Steps To Reproduce
`dbt-init`

### Expected behavior
A clear and concise description of what you expected to happen.

### Screenshots and log output
If applicable, add screenshots or log output to help explain your problem.

### System information
**Which database are you using dbt with?**
- [ ] postgres
- [ ] redshift
- [ ] bigquery
- [X] snowflake
- [ ] other (specify: ____________)


**The output of `dbt --version`:**
```
installed version: 0.17.0-b1
   latest version: 0.16.1

Your version of dbt is ahead of the latest release!

Plugins: [empty, but dbt-utils and snowflake-spend are installed]
```

**The operating system you're using:**
Windows 10 64bit

**The output of `python --version`:**
Python 3.8.2

### Additional context
Add any other context about the problem here.



Discussion:
thanks for the heads up @swiffer! This is a sort of tricky thing to navigate, as we want old versions of dbt (which _do not_ support `config-version: 2`) to continue to clone valid starter projects.

I suppose we could either create a branch (not a great idea) or a separate repo. Either way - this is definitely something we should address before 0.17.0 goes live!

Resolving patch:
diff --git a/core/dbt/clients/git.py b/core/dbt/clients/git.py
--- a/core/dbt/clients/git.py
+++ b/core/dbt/clients/git.py
@@ -6,8 +6,13 @@
 import dbt.exceptions
 
 
-def clone(repo, cwd, dirname=None, remove_git_dir=False):
-    clone_cmd = ['git', 'clone', '--depth', '1', repo]
+def clone(repo, cwd, dirname=None, remove_git_dir=False, branch=None):
+    clone_cmd = ['git', 'clone', '--depth', '1']
+
+    if branch is not None:
+        clone_cmd.extend(['--branch', branch])
+
+    clone_cmd.append(repo)
 
     if dirname is not None:
         clone_cmd.append(dirname)
diff --git a/core/dbt/task/init.py b/core/dbt/task/init.py
--- a/core/dbt/task/init.py
+++ b/core/dbt/task/init.py
@@ -9,6 +9,7 @@
 from dbt.task.base import BaseTask
 
 STARTER_REPO = 'https://github.com/fishtown-analytics/dbt-starter-project.git'
+STARTER_BRANCH = 'dbt-yml-config-version-2'
 DOCS_URL = 'https://docs.getdbt.com/docs/configure-your-profile'
 SAMPLE_PROFILES_YML_FILE = 'https://docs.getdbt.com/docs/profile'  # noqa
 
@@ -62,8 +63,12 @@
 class InitTask(BaseTask):
     def clone_starter_repo(self, project_name):
         dbt.clients.git.clone(
-            STARTER_REPO, '.', project_name,
-            remove_git_dir=True)
+            STARTER_REPO,
+            cwd='.',
+            dirname=project_name,
+            remove_git_dir=True,
+            branch=STARTER_BRANCH,
+        )
 
     def create_profiles_dir(self, profiles_dir):
         if not os.path.exists(profiles_dir):


Test patch:
diff --git a/test/integration/040_init_test/test_init.py b/test/integration/040_init_test/test_init.py
--- a/test/integration/040_init_test/test_init.py
+++ b/test/integration/040_init_test/test_init.py
@@ -2,6 +2,7 @@
 from test.integration.base import DBTIntegrationTest, use_profile
 import os
 import shutil
+import yaml
 
 
 class TestInit(DBTIntegrationTest):
@@ -29,13 +30,14 @@ def test_postgres_init_task(self):
         project_name = self.get_project_name()
         self.run_dbt(['init', project_name])
 
-        dir_exists = os.path.exists(project_name)
+        assert os.path.exists(project_name)
         project_file = os.path.join(project_name, 'dbt_project.yml')
-        project_file_exists = os.path.exists(project_file)
+        assert os.path.exists(project_file)
+        with open(project_file) as fp:
+            project_data = yaml.safe_load(fp.read())
 
-        git_dir = os.path.join(project_name, '.git')
-        git_dir_exists = os.path.exists(git_dir)
+        assert 'config-version' in project_data
+        assert project_data['config-version'] == 2
 
-        self.assertTrue(dir_exists)
-        self.assertTrue(project_file_exists)
-        self.assertFalse(git_dir_exists)
+        git_dir = os.path.join(project_name, '.git')
+        assert not os.path.exists(git_dir)