Repository: packit/packit
Issue: `source-git init` fails if the source-git repo has no remotes

```
$ git init $SOURCE_GIT_REPO

$ packit source-git init $REF $SOURCE_GIT_REPO $DIST_GIT_REPO
2021-09-13 16:02:55.154 source_git_init.py WARNING Generating source-git repositories is experimental, please give us feedback if it does things differently than you expect.
Traceback (most recent call last):
  File "/bin/packit", line 33, in <module>
    sys.exit(load_entry_point('packitos==0.36.0', 'console_scripts', 'packit')())
  File "/usr/lib/python3.9/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3.9/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3.9/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3.9/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3.9/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3.9/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3.9/site-packages/click/decorators.py", line 73, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/usr/lib/python3.9/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3.9/site-packages/packit/cli/source_git_init.py", line 89, in source_git_init
    api.init_source_git(
  File "/usr/lib/python3.9/site-packages/packit/api.py", line 1046, in init_source_git
    sgg = SourceGitGenerator(
  File "/usr/lib/python3.9/site-packages/packit/source_git.py", line 78, in __init__
    self.source_git.remote(upstream_remote or "origin").urls
  File "/home/tt/.local/lib/python3.9/site-packages/git/repo/base.py", line 354, in remote
    raise ValueError("Remote named '%s' didn't exist" % name)
ValueError: Remote named 'origin' didn't exist
```

~~there are no remotes in $SOURCE_GIT_REPO so we should tweak that if statement and account for repos with no remotes~~

there is also a possibility to make this a requirement and require the $SOURCE_GIT_REPO to be a clone of the upstream repo (which makes sense)

...thinking...

now that I look at this, it doesn't make sense :D $SOURCE_GIT_REPO needs to be the clone of upstream repo, so let's just fix the traceback

Changed files:
packit/cli/source_git_init.py, packit/source_git.py

diff --git a/packit/cli/source_git_init.py b/packit/cli/source_git_init.py
index 43326b70..2d1e6e58 100644
--- a/packit/cli/source_git_init.py
+++ b/packit/cli/source_git_init.py
@@ -10,6 +10,7 @@ import click
 import git
 
 from packit.cli.types import GitRepoParameter
+from packit.cli.utils import cover_packit_exception
 from packit.api import PackitAPI
 from packit.config.config import pass_config
 from packit.config import get_context_settings
@@ -46,6 +47,7 @@ logger = logging.getLogger(__name__)
     Defaults to the directory name of DIST_GIT.""",
 )
 @pass_config
+@cover_packit_exception
 def source_git_init(
     config,
     dist_git: git.Repo,
@@ -59,6 +61,8 @@ def source_git_init(
     """Initialize SOURCE_GIT as a source-git repo by applying downstream
     patches from DIST_GIT as Git commits on top of UPSTREAM_REF.
 
+    SOURCE_GIT needs to be an existing clone of the upstream repository.
+
     UPSTREAM_REF is a tag, branch or commit from SOURCE_GIT.
 
     SOURCE_GIT and DIST_GIT are paths to the source-git and dist-git
diff --git a/packit/source_git.py b/packit/source_git.py
index a0de5c2f..a97c25fb 100644
--- a/packit/source_git.py
+++ b/packit/source_git.py
@@ -52,7 +52,7 @@ class SourceGitGenerator:
             source-git history. This can be a branch, tag or commit sha. It is expected
             that the current HEAD and this ref point to the same commit.
         upstream_url: Git URL to be saved in the source-git configuration. If not specified,
-            the fetch URL of the 'origin' remote us used, unless 'upstream_remote' is set.
+            the fetch URL of the 'origin' remote is used, unless 'upstream_remote' is set.
         upstream_remote: Name of the remote from which the fetch URL is taken as the Git URL
             of the upstream project to be saved in the source-git configuration.
         pkg_tool: Packaging tool to be used to interact with the dist-git repo.
@@ -74,9 +74,18 @@ class SourceGitGenerator:
         self.source_git = source_git
         self.dist_git = dist_git
         self.upstream_ref = upstream_ref
-        self.upstream_url = upstream_url or next(
-            self.source_git.remote(upstream_remote or "origin").urls
-        )
+        try:
+            self.upstream_url = upstream_url or next(
+                self.source_git.remote(upstream_remote or "origin").urls
+            )
+        except ValueError as exc:
+            logger.debug(f"Failed when getting upstream URL: {exc}")
+            raise PackitException(
+                "Unable to tell the URL of the upstream repository because there is no remote "
+                f"called '{upstream_remote or 'origin'}' in {self.source_git.working_dir}. "
+                "Please specify the correct upstream remote using '--upstream-remote' or the "
+                "upstream URL, using '--upstream-url'."
+            )
         self.pkg_tool = pkg_tool
         self.pkg_name = pkg_name or Path(self.dist_git.working_dir).name