We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Fail with gitolite repository
* Cookiecutter version: 1.6.0
* Template project url: Any
* Python version: Any (tested in 3.7)
* Operating System: Any (testes in ubuntu 16.04 and w$ 10)

### Description:

You are running a gitolite in "gitserver" and have a repository "mytemplate". When you run this::

    cookiecutter git clone git@gitserver:mytemplate

You get this fail::

    A valid repository for "git@gitserver:mytemplate" could not be found in the following locations:
C:\Users\javier\.cookiecutters\git@gitserver:mytemplate

### What I've run:

```
$ cookiecutter -v --debug-file log.txt git@gitserver:mytemplate
DEBUG cookiecutter.config: config_path is /home/jsanchez/.cookiecutterrc
DEBUG cookiecutter.utils: Making sure path exists: /home/jsanchez/.cookiecutters/
DEBUG cookiecutter.vcs: repo_dir is /home/jsanchez/.cookiecutters/git@gitserver:mytemplate
Clonar en «mytemplate»...
X11 forwarding request failed on channel 0
remote: Counting objects: 142, done.
remote: Compressing objects: 100% (118/118), done.
remote: Total 142 (delta 14), reused 0 (delta 0)
Receiving objects: 100% (142/142), 91.09 KiB | 0 bytes/s, done.
Resolving deltas: 100% (14/14), done.
Comprobando la conectividad… hecho.
A valid repository for "git@gitserver:mytemplate" could not be found in the following locations:
/home/jsanchez/.cookiecutters/git@gitserver:mytemplate
```
The repository mytemplate is correctly cloned in ~/.cookiecutters/mytemplate::
```
$ ls ~/.cookiecutters/cmsc_tmpl_python/
bin           cookiecutter.json              docs     doit.cfg  LICENSE     poetry.lock     README.md  tests
CHANGELOG.md  {{cookiecutter.project_slug}}  dodo.py  hooks     mkdocs.yml  pyproject.toml  tasks.txt  tox.ini
```
But `repo_dir` points to `~/.cookiecutters/git@gitserver:mytemplate` which don't exists.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `cookiecutter/vcs.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 
3 """Helper functions for working with version control systems."""
4 
5 from __future__ import unicode_literals
6 import logging
7 import os
8 import subprocess
9 
10 try:
11     from shutil import which
12 except ImportError:
13     from whichcraft import which
14 
15 from cookiecutter.exceptions import (
16     RepositoryNotFound,
17     RepositoryCloneFailed,
18     UnknownRepoType,
19     VCSNotInstalled,
20 )
21 from cookiecutter.utils import make_sure_path_exists, prompt_and_delete
22 
23 logger = logging.getLogger(__name__)
24 
25 
26 BRANCH_ERRORS = [
27     'error: pathspec',
28     'unknown revision',
29 ]
30 
31 
32 def identify_repo(repo_url):
33     """Determine if `repo_url` should be treated as a URL to a git or hg repo.
34 
35     Repos can be identified by prepending "hg+" or "git+" to the repo URL.
36 
37     :param repo_url: Repo URL of unknown type.
38     :returns: ('git', repo_url), ('hg', repo_url), or None.
39     """
40     repo_url_values = repo_url.split('+')
41     if len(repo_url_values) == 2:
42         repo_type = repo_url_values[0]
43         if repo_type in ["git", "hg"]:
44             return repo_type, repo_url_values[1]
45         else:
46             raise UnknownRepoType
47     else:
48         if 'git' in repo_url:
49             return 'git', repo_url
50         elif 'bitbucket' in repo_url:
51             return 'hg', repo_url
52         else:
53             raise UnknownRepoType
54 
55 
56 def is_vcs_installed(repo_type):
57     """
58     Check if the version control system for a repo type is installed.
59 
60     :param repo_type:
61     """
62     return bool(which(repo_type))
63 
64 
65 def clone(repo_url, checkout=None, clone_to_dir='.', no_input=False):
66     """Clone a repo to the current directory.
67 
68     :param repo_url: Repo URL of unknown type.
69     :param checkout: The branch, tag or commit ID to checkout after clone.
70     :param clone_to_dir: The directory to clone to.
71                          Defaults to the current directory.
72     :param no_input: Suppress all user prompts when calling via API.
73     """
74     # Ensure that clone_to_dir exists
75     clone_to_dir = os.path.expanduser(clone_to_dir)
76     make_sure_path_exists(clone_to_dir)
77 
78     # identify the repo_type
79     repo_type, repo_url = identify_repo(repo_url)
80 
81     # check that the appropriate VCS for the repo_type is installed
82     if not is_vcs_installed(repo_type):
83         msg = "'{0}' is not installed.".format(repo_type)
84         raise VCSNotInstalled(msg)
85 
86     repo_url = repo_url.rstrip('/')
87     tail = os.path.split(repo_url)[1]
88     if repo_type == 'git':
89         repo_dir = os.path.normpath(os.path.join(clone_to_dir, tail.rsplit('.git')[0]))
90     elif repo_type == 'hg':
91         repo_dir = os.path.normpath(os.path.join(clone_to_dir, tail))
92     logger.debug('repo_dir is %s', repo_dir)
93 
94     if os.path.isdir(repo_dir):
95         clone = prompt_and_delete(repo_dir, no_input=no_input)
96     else:
97         clone = True
98 
99     if clone:
100         try:
101             subprocess.check_output(
102                 [repo_type, 'clone', repo_url],
103                 cwd=clone_to_dir,
104                 stderr=subprocess.STDOUT,
105             )
106             if checkout is not None:
107                 subprocess.check_output(
108                     [repo_type, 'checkout', checkout],
109                     cwd=repo_dir,
110                     stderr=subprocess.STDOUT,
111                 )
112         except subprocess.CalledProcessError as clone_error:
113             output = clone_error.output.decode('utf-8')
114             if 'not found' in output.lower():
115                 raise RepositoryNotFound(
116                     'The repository {} could not be found, '
117                     'have you made a typo?'.format(repo_url)
118                 )
119             if any(error in output for error in BRANCH_ERRORS):
120                 raise RepositoryCloneFailed(
121                     'The {} branch of repository {} could not found, '
122                     'have you made a typo?'.format(checkout, repo_url)
123                 )
124             raise
125 
126     return repo_dir
127
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/cookiecutter/vcs.py b/cookiecutter/vcs.py
--- a/cookiecutter/vcs.py
+++ b/cookiecutter/vcs.py
@@ -70,6 +70,7 @@
     :param clone_to_dir: The directory to clone to.
                          Defaults to the current directory.
     :param no_input: Suppress all user prompts when calling via API.
+    :returns: str with path to the new directory of the repository.
     """
     # Ensure that clone_to_dir exists
     clone_to_dir = os.path.expanduser(clone_to_dir)
@@ -84,12 +85,13 @@
         raise VCSNotInstalled(msg)
 
     repo_url = repo_url.rstrip('/')
-    tail = os.path.split(repo_url)[1]
+    repo_name = os.path.split(repo_url)[1]
     if repo_type == 'git':
-        repo_dir = os.path.normpath(os.path.join(clone_to_dir, tail.rsplit('.git')[0]))
+        repo_name = repo_name.split(':')[-1].rsplit('.git')[0]
+        repo_dir = os.path.normpath(os.path.join(clone_to_dir, repo_name))
     elif repo_type == 'hg':
-        repo_dir = os.path.normpath(os.path.join(clone_to_dir, tail))
-    logger.debug('repo_dir is %s', repo_dir)
+        repo_dir = os.path.normpath(os.path.join(clone_to_dir, repo_name))
+    logger.debug('repo_dir is {0}'.format(repo_dir))
 
     if os.path.isdir(repo_dir):
         clone = prompt_and_delete(repo_dir, no_input=no_input)

{"golden_diff": "diff --git a/cookiecutter/vcs.py b/cookiecutter/vcs.py\n--- a/cookiecutter/vcs.py\n+++ b/cookiecutter/vcs.py\n@@ -70,6 +70,7 @@\n     :param clone_to_dir: The directory to clone to.\n                          Defaults to the current directory.\n     :param no_input: Suppress all user prompts when calling via API.\n+    :returns: str with path to the new directory of the repository.\n     \"\"\"\n     # Ensure that clone_to_dir exists\n     clone_to_dir = os.path.expanduser(clone_to_dir)\n@@ -84,12 +85,13 @@\n         raise VCSNotInstalled(msg)\n \n     repo_url = repo_url.rstrip('/')\n-    tail = os.path.split(repo_url)[1]\n+    repo_name = os.path.split(repo_url)[1]\n     if repo_type == 'git':\n-        repo_dir = os.path.normpath(os.path.join(clone_to_dir, tail.rsplit('.git')[0]))\n+        repo_name = repo_name.split(':')[-1].rsplit('.git')[0]\n+        repo_dir = os.path.normpath(os.path.join(clone_to_dir, repo_name))\n     elif repo_type == 'hg':\n-        repo_dir = os.path.normpath(os.path.join(clone_to_dir, tail))\n-    logger.debug('repo_dir is %s', repo_dir)\n+        repo_dir = os.path.normpath(os.path.join(clone_to_dir, repo_name))\n+    logger.debug('repo_dir is {0}'.format(repo_dir))\n \n     if os.path.isdir(repo_dir):\n         clone = prompt_and_delete(repo_dir, no_input=no_input)\n", "issue": "Fail with gitolite repository\n* Cookiecutter version: 1.6.0\r\n* Template project url: Any\r\n* Python version: Any (tested in 3.7)\r\n* Operating System: Any (testes in ubuntu 16.04 and w$ 10)\r\n\r\n### Description:\r\n\r\nYou are running a gitolite in \"gitserver\" and have a repository \"mytemplate\". When you run this::\r\n\r\n    cookiecutter git clone git@gitserver:mytemplate\r\n\r\nYou get this fail::\r\n\r\n    A valid repository for \"git@gitserver:mytemplate\" could not be found in the following locations:\r\nC:\\Users\\javier\\.cookiecutters\\git@gitserver:mytemplate\r\n\r\n### What I've run:\r\n\r\n```\r\n$ cookiecutter -v --debug-file log.txt git@gitserver:mytemplate\r\nDEBUG cookiecutter.config: config_path is /home/jsanchez/.cookiecutterrc\r\nDEBUG cookiecutter.utils: Making sure path exists: /home/jsanchez/.cookiecutters/\r\nDEBUG cookiecutter.vcs: repo_dir is /home/jsanchez/.cookiecutters/git@gitserver:mytemplate\r\nClonar en \u00abmytemplate\u00bb...\r\nX11 forwarding request failed on channel 0\r\nremote: Counting objects: 142, done.\r\nremote: Compressing objects: 100% (118/118), done.\r\nremote: Total 142 (delta 14), reused 0 (delta 0)\r\nReceiving objects: 100% (142/142), 91.09 KiB | 0 bytes/s, done.\r\nResolving deltas: 100% (14/14), done.\r\nComprobando la conectividad\u2026 hecho.\r\nA valid repository for \"git@gitserver:mytemplate\" could not be found in the following locations:\r\n/home/jsanchez/.cookiecutters/git@gitserver:mytemplate\r\n```\r\nThe repository mytemplate is correctly cloned in ~/.cookiecutters/mytemplate::\r\n```\r\n$ ls ~/.cookiecutters/cmsc_tmpl_python/\r\nbin           cookiecutter.json              docs     doit.cfg  LICENSE     poetry.lock     README.md  tests\r\nCHANGELOG.md  {{cookiecutter.project_slug}}  dodo.py  hooks     mkdocs.yml  pyproject.toml  tasks.txt  tox.ini\r\n```\r\nBut `repo_dir` points to `~/.cookiecutters/git@gitserver:mytemplate` which don't exists.\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\n\"\"\"Helper functions for working with version control systems.\"\"\"\n\nfrom __future__ import unicode_literals\nimport logging\nimport os\nimport subprocess\n\ntry:\n    from shutil import which\nexcept ImportError:\n    from whichcraft import which\n\nfrom cookiecutter.exceptions import (\n    RepositoryNotFound,\n    RepositoryCloneFailed,\n    UnknownRepoType,\n    VCSNotInstalled,\n)\nfrom cookiecutter.utils import make_sure_path_exists, prompt_and_delete\n\nlogger = logging.getLogger(__name__)\n\n\nBRANCH_ERRORS = [\n    'error: pathspec',\n    'unknown revision',\n]\n\n\ndef identify_repo(repo_url):\n    \"\"\"Determine if `repo_url` should be treated as a URL to a git or hg repo.\n\n    Repos can be identified by prepending \"hg+\" or \"git+\" to the repo URL.\n\n    :param repo_url: Repo URL of unknown type.\n    :returns: ('git', repo_url), ('hg', repo_url), or None.\n    \"\"\"\n    repo_url_values = repo_url.split('+')\n    if len(repo_url_values) == 2:\n        repo_type = repo_url_values[0]\n        if repo_type in [\"git\", \"hg\"]:\n            return repo_type, repo_url_values[1]\n        else:\n            raise UnknownRepoType\n    else:\n        if 'git' in repo_url:\n            return 'git', repo_url\n        elif 'bitbucket' in repo_url:\n            return 'hg', repo_url\n        else:\n            raise UnknownRepoType\n\n\ndef is_vcs_installed(repo_type):\n    \"\"\"\n    Check if the version control system for a repo type is installed.\n\n    :param repo_type:\n    \"\"\"\n    return bool(which(repo_type))\n\n\ndef clone(repo_url, checkout=None, clone_to_dir='.', no_input=False):\n    \"\"\"Clone a repo to the current directory.\n\n    :param repo_url: Repo URL of unknown type.\n    :param checkout: The branch, tag or commit ID to checkout after clone.\n    :param clone_to_dir: The directory to clone to.\n                         Defaults to the current directory.\n    :param no_input: Suppress all user prompts when calling via API.\n    \"\"\"\n    # Ensure that clone_to_dir exists\n    clone_to_dir = os.path.expanduser(clone_to_dir)\n    make_sure_path_exists(clone_to_dir)\n\n    # identify the repo_type\n    repo_type, repo_url = identify_repo(repo_url)\n\n    # check that the appropriate VCS for the repo_type is installed\n    if not is_vcs_installed(repo_type):\n        msg = \"'{0}' is not installed.\".format(repo_type)\n        raise VCSNotInstalled(msg)\n\n    repo_url = repo_url.rstrip('/')\n    tail = os.path.split(repo_url)[1]\n    if repo_type == 'git':\n        repo_dir = os.path.normpath(os.path.join(clone_to_dir, tail.rsplit('.git')[0]))\n    elif repo_type == 'hg':\n        repo_dir = os.path.normpath(os.path.join(clone_to_dir, tail))\n    logger.debug('repo_dir is %s', repo_dir)\n\n    if os.path.isdir(repo_dir):\n        clone = prompt_and_delete(repo_dir, no_input=no_input)\n    else:\n        clone = True\n\n    if clone:\n        try:\n            subprocess.check_output(\n                [repo_type, 'clone', repo_url],\n                cwd=clone_to_dir,\n                stderr=subprocess.STDOUT,\n            )\n            if checkout is not None:\n                subprocess.check_output(\n                    [repo_type, 'checkout', checkout],\n                    cwd=repo_dir,\n                    stderr=subprocess.STDOUT,\n                )\n        except subprocess.CalledProcessError as clone_error:\n            output = clone_error.output.decode('utf-8')\n            if 'not found' in output.lower():\n                raise RepositoryNotFound(\n                    'The repository {} could not be found, '\n                    'have you made a typo?'.format(repo_url)\n                )\n            if any(error in output for error in BRANCH_ERRORS):\n                raise RepositoryCloneFailed(\n                    'The {} branch of repository {} could not found, '\n                    'have you made a typo?'.format(checkout, repo_url)\n                )\n            raise\n\n    return repo_dir\n", "path": "cookiecutter/vcs.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n\n\"\"\"Helper functions for working with version control systems.\"\"\"\n\nfrom __future__ import unicode_literals\nimport logging\nimport os\nimport subprocess\n\ntry:\n    from shutil import which\nexcept ImportError:\n    from whichcraft import which\n\nfrom cookiecutter.exceptions import (\n    RepositoryNotFound,\n    RepositoryCloneFailed,\n    UnknownRepoType,\n    VCSNotInstalled,\n)\nfrom cookiecutter.utils import make_sure_path_exists, prompt_and_delete\n\nlogger = logging.getLogger(__name__)\n\n\nBRANCH_ERRORS = [\n    'error: pathspec',\n    'unknown revision',\n]\n\n\ndef identify_repo(repo_url):\n    \"\"\"Determine if `repo_url` should be treated as a URL to a git or hg repo.\n\n    Repos can be identified by prepending \"hg+\" or \"git+\" to the repo URL.\n\n    :param repo_url: Repo URL of unknown type.\n    :returns: ('git', repo_url), ('hg', repo_url), or None.\n    \"\"\"\n    repo_url_values = repo_url.split('+')\n    if len(repo_url_values) == 2:\n        repo_type = repo_url_values[0]\n        if repo_type in [\"git\", \"hg\"]:\n            return repo_type, repo_url_values[1]\n        else:\n            raise UnknownRepoType\n    else:\n        if 'git' in repo_url:\n            return 'git', repo_url\n        elif 'bitbucket' in repo_url:\n            return 'hg', repo_url\n        else:\n            raise UnknownRepoType\n\n\ndef is_vcs_installed(repo_type):\n    \"\"\"\n    Check if the version control system for a repo type is installed.\n\n    :param repo_type:\n    \"\"\"\n    return bool(which(repo_type))\n\n\ndef clone(repo_url, checkout=None, clone_to_dir='.', no_input=False):\n    \"\"\"Clone a repo to the current directory.\n\n    :param repo_url: Repo URL of unknown type.\n    :param checkout: The branch, tag or commit ID to checkout after clone.\n    :param clone_to_dir: The directory to clone to.\n                         Defaults to the current directory.\n    :param no_input: Suppress all user prompts when calling via API.\n    :returns: str with path to the new directory of the repository.\n    \"\"\"\n    # Ensure that clone_to_dir exists\n    clone_to_dir = os.path.expanduser(clone_to_dir)\n    make_sure_path_exists(clone_to_dir)\n\n    # identify the repo_type\n    repo_type, repo_url = identify_repo(repo_url)\n\n    # check that the appropriate VCS for the repo_type is installed\n    if not is_vcs_installed(repo_type):\n        msg = \"'{0}' is not installed.\".format(repo_type)\n        raise VCSNotInstalled(msg)\n\n    repo_url = repo_url.rstrip('/')\n    repo_name = os.path.split(repo_url)[1]\n    if repo_type == 'git':\n        repo_name = repo_name.split(':')[-1].rsplit('.git')[0]\n        repo_dir = os.path.normpath(os.path.join(clone_to_dir, repo_name))\n    elif repo_type == 'hg':\n        repo_dir = os.path.normpath(os.path.join(clone_to_dir, repo_name))\n    logger.debug('repo_dir is {0}'.format(repo_dir))\n\n    if os.path.isdir(repo_dir):\n        clone = prompt_and_delete(repo_dir, no_input=no_input)\n    else:\n        clone = True\n\n    if clone:\n        try:\n            subprocess.check_output(\n                [repo_type, 'clone', repo_url],\n                cwd=clone_to_dir,\n                stderr=subprocess.STDOUT,\n            )\n            if checkout is not None:\n                subprocess.check_output(\n                    [repo_type, 'checkout', checkout],\n                    cwd=repo_dir,\n                    stderr=subprocess.STDOUT,\n                )\n        except subprocess.CalledProcessError as clone_error:\n            output = clone_error.output.decode('utf-8')\n            if 'not found' in output.lower():\n                raise RepositoryNotFound(\n                    'The repository {} could not be found, '\n                    'have you made a typo?'.format(repo_url)\n                )\n            if any(error in output for error in BRANCH_ERRORS):\n                raise RepositoryCloneFailed(\n                    'The {} branch of repository {} could not found, '\n                    'have you made a typo?'.format(checkout, repo_url)\n                )\n            raise\n\n    return repo_dir\n", "path": "cookiecutter/vcs.py"}]}