Repository: beeware/briefcase

Issue:
Briefcase's attempt to set the URL for the `origin` remote for templates can fail with certain Git config
### Describe the bug

The configuration below can cause Briefcase to fail to roll out templates.
```ini
[url "ssh://git@github.com/"]
    insteadOf = https://github.com/
```
```console
❯ briefcase new --no-input -vvv

[helloworld] Generating a new application 'Hello World'
Using app template: https://github.com/beeware/briefcase-template, branch v0.3.20
DEBUG git.util: Failed checking if running in CYGWIN due to: FileNotFoundError(2, 'No such file or directory')
DEBUG git.cmd: Popen(['git', 'remote', 'set-url', '--', 'origin', 'https://github.com/beeware/briefcase-template', 'https://github.com/beeware/briefcase-template'], cwd=/Users/rmartin/Library/Caches/org.beeware.briefcase/templates/briefcase-template, stdin=None, shell=False, universal_newlines=False)

Unable to check out template branch.

This may be because your computer is offline, or because the template repository
is in a weird state. If you have a stable network connection, try deleting:

    /Users/rmartin/Library/Caches/org.beeware.briefcase/templates/briefcase-template

and retrying your command.

Log saved to /Users/rmartin/tmp/beeware/logs/briefcase.2024_12_08-11_33_10.new.log
```
This is the actual error from Git:
```console
GitCommandError: Cmd('git') failed due to: exit code(128)
  cmdline: git remote set-url -- origin https://github.com/beeware/briefcase-template https://github.com/beeware/briefcase-template
  stderr: 'fatal: No such URL found: https://github.com/beeware/briefcase-template'
```

### Steps to reproduce

1. Add the configuration above to `~/.gitconfig`
2. Run `briefcase new --no-input`


### Expected behavior

Briefcase should not fail to use templates because it cannot update the URL of the `origin` remote....especially since this was added largely for the benefit of Briefcase developers...

Instead:
1) Briefcase should log a warning and move on using the template
2) Briefcase could try to update the URL without specifying an "old url"

As for number 2, specifying the "old url" is optional. Given that Briefcase is supposed to be managing these cloned repos, it seems like it should be fine to just blindly update the URL for the `origin` remote.

### Screenshots

_No response_

### Environment

- Operating System: Sequoia
- Python version: 3.12.7
- Software versions:
  - Briefcase: `0.3.20`

### Logs

[briefcase.2024_12_08-11_33_10.new.log](https://github.com/user-attachments/files/18053171/briefcase.2024_12_08-11_33_10.new.log)


### Additional context

_No response_
Broken steps for Beeware Tutorial
### Describe the bug

Tutorial steps broken.

### Steps to reproduce
```
$briefcase create

[helloworld] Generating application template...
Using app template: /Users/en/briefcase-template, branch v0.3.20

Log saved to /Users/en/beeware-tutorial/helloworld/logs/briefcase.2024_12_13-15_21_01.create.log

Traceback (most recent call last):
  File "/Users/en/beeware-tutorial/beeware-venv/bin/briefcase", line 8, in <module>
    sys.exit(main())
  File "/Users/en/beeware-tutorial/beeware-venv/lib/python3.10/site-packages/briefcase/__main__.py", line 29, in main
    command(**options)
  File "/Users/en/beeware-tutorial/beeware-venv/lib/python3.10/site-packages/briefcase/commands/create.py", line 949, in __call__
    state = self.create_app(app, **full_options(state, options))
  File "/Users/en/beeware-tutorial/beeware-venv/lib/python3.10/site-packages/briefcase/commands/create.py", line 885, in create_app
    self.generate_app_template(app=app)
  File "/Users/en/beeware-tutorial/beeware-venv/lib/python3.10/site-packages/briefcase/commands/create.py", line 255, in generate_app_template
    self.generate_template(
  File "/Users/en/beeware-tutorial/beeware-venv/lib/python3.10/site-packages/briefcase/commands/base.py", line 1119, in generate_template
    self._generate_template(
  File "/Users/en/beeware-tutorial/beeware-venv/lib/python3.10/site-packages/briefcase/commands/base.py", line 1064, in _generate_template
    self.tools.cookiecutter(
  File "/Users/en/beeware-tutorial/beeware-venv/lib/python3.10/site-packages/cookiecutter/main.py", line 125, in cookiecutter
    context = generate_context(
  File "/Users/en/beeware-tutorial/beeware-venv/lib/python3.10/site-packages/cookiecutter/generate.py", line 145, in generate_context
    apply_overwrites_to_context(obj, extra_context)
  File "/Users/en/beeware-tutorial/beeware-venv/lib/python3.10/site-packages/cookiecutter/generate.py", line 89, in apply_overwrites_to_context
    raise ValueError(
ValueError: {'file': 'Other'} provided for choice variable license, but the choices are ['BSD license', 'MIT license', 'Apache Software License', 'GNU General Public License v2 (GPLv2)', 'GNU General Public License v2 or later (GPLv2+)', 'GNU General Public License v3 (GPLv3)', 'GNU General Public License v3 or later (GPLv3+)', 'Proprietary', 'Other'].
```

### Expected behavior

Packaging app for distribuiton

### Screenshots

_No response_

### Environment

- Operating System:MacOS Ventura 15.1
- Python version:3.10.7
- Software versions:
  - Briefcase:
  - Toga:
  - ...


### Logs


body is too long (maximum is 65536 characters). error so I pasted it:
https://pastebin.com/hDcZiPRw




### Additional context

_No response_


Discussion:
Good catch. 

For completeness - two more possible solutions: 
3. Abort the run, with instructions on how to delete the template that is in conflict and retry.
4. Delete the problem template (after confirmation), and re-try the template clone from a clean state.

That said: I'm trying to work out if being explicit about the old URL is actually providing *any* protection at all. The use case in the related docstring talks about forked templates - but in that case, you'd update the repo origin, fetch the new origin, get a whole lot of new SHAs and branches, and then check out the one that has been explicitly requested. 

Even if the template shared no common history... I think it would still work? It would end up being a mess of a repo, but it should *work*. The worst case I can think of would be a fork where the branch name contains inconsistent/incompatible changes - in which case, the worst case I can foresee is that the checkout fails because of the inconsistency. We should ensure the error handling is more helpful than "you may be offline", but enforcing the old origin URL could actually be preventing us from recoverable situations.

Am I missing a case where specifying the old URL is providing any real protection?


> For completeness - two more possible solutions:
> 3. Abort the run, with instructions on how to delete the template that is in conflict and retry.
> 4. Delete the problem template (after confirmation), and re-try the template clone from a clean state.

This is what happens now, though....but no amount of re-cloning will get rid of this specific problem.

> Am I missing a case where specifying the old URL is providing any real protection?

As long as `set-url` only runs for cloned templates in Briefcase's cache directory, I think it'd be fine. Basically, we'd just be saying, "no matter what, `origin` is at this URL now".....which would either be a user-provided URL or the default Briefcase one.

And if I were to guess, I think the actual purpose of specifying an "old url" is because I think Git supports multiple URLs for some of these settings for a remote; so, you'd be able to replace a specific URL for the setting.
> > For completeness - two more possible solutions:
> > 3. Abort the run, with instructions on how to delete the template that is in conflict and retry.
> > 4. Delete the problem template (after confirmation), and re-try the template clone from a clean state.
> 
> This is what happens now, though....but no amount of re-cloning will get rid of this specific problem.

That delete-and-re-clone behavior is only enacted if the repo is in a fundamentally invalid state - not in the "origin mismatch" case - or am I missing something?
 
> > Am I missing a case where specifying the old URL is providing any real protection?
> 
> As long as `set-url` only runs for cloned templates in Briefcase's cache directory, I think it'd be fine. Basically, we'd just be saying, "no matter what, `origin` is at this URL now".....which would either be a user-provided URL or the default Briefcase one.

That's a fairly safe assumption here - the first thing `update_cookiecutter_cache()` does is establish a cache path that is in `data_path`. A backend *could* override `template_cache_path()`, but I'd be happy flagging as documentation that the path returned by that method should be "briefcase specific", not a cache directory that is likely be to used by others.
 

> That delete-and-re-clone behavior is only enacted if the repo is in a fundamentally invalid state - not in the "origin mismatch" case - or am I missing something?

Oh, right; Briefcase won't automatically delete the cloned repo in this case. I just meant Briefcase already outputs an error asking the user to manually delete the template repo and try again. But in this case, we must change how the `set-url` command is handled; either don't specify the "old url" or don't abort if it errors (since in 99% of cases, the repo won't need any updates to `origin` anyway).

Looking at `pyproject.toml`, did you add this setting to `[tool.briefcase]`?
```
template = "/Users/en/briefcase-template"
```
If so, why?
It was the only way to make it work with at least the dev mode. Before that I would get 

```
$briefcase create

[helloworld] Generating application template...
Using app template: https://github.com/beeware/briefcase-macOS-app-template.git, branch v0.3.20
Cloning template 'https://github.com/beeware/briefcase-macOS-app-template.git'...

Unable to check out template branch.

This may be because your computer is offline, or because the template repository
is in a weird state. If you have a stable network connection, try deleting:

    /Users/en/Library/Caches/org.beeware.briefcase/templates/briefcase-macOS-app-template

and retrying your command.

Log saved to /Users/en/beeware-tutorial/helloworld/logs/briefcase.2024_12_15-07_19_26.create.log

(beeware-venv)
```
<details>
<summary>and here's the log</summary>

```
Date/Time:       2024-12-15 07:19:27 
Command line:    /Users/en/beeware-tutorial/beeware-venv/bin/briefcase create

OS Release:      Darwin 24.1.0
OS Version:      Darwin Kernel Version 24.1.0: Thu Oct 10 21:03:15 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T6000
Architecture:    arm64
Platform:        macOS-15.1.1-arm64-arm-64bit

Python exe:      /Users/en/beeware-tutorial/beeware-venv/bin/python
Python version:  3.10.7 (v3.10.7:6cc6b13308, Sep  5 2022, 14:02:52) [Clang 13.0.0 (clang-1300.0.29.30)]
Virtual env:     True
Conda env:       False

Briefcase:       0.3.20
Target platform: macOS
Target format:   app

Environment Variables:
	ANDROID_NDK_HOME=/opt/homebrew/share/android-ndk
	CLICOLOR=1
	COLORFGBG=15;0
	COLORTERM=truecolor
	COMMAND_MODE=unix2003
	CPATH=/opt/homebrew/include
	GEM_HOME=/Users/en/.rvm/gems/ruby-3.2.2
	GEM_PATH=/Users/en/.rvm/gems/ruby-3.2.2:/Users/en/.rvm/gems/ruby-3.2.2@global
	GREP_COLOR=1;35;40
	GREP_OPTIONS=--color=auto
	GVM_PATH_BACKUP=/Users/en/.gvm/bin:/opt/homebrew/Cellar/openjdk/21.0.2/libexec/openjdk.jdk/Contents/Home/bin:~/.bin:/Library/Frameworks/Python.framework/Versions/3.10/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Applications/Sublime Text.app/Contents/SharedSupport/bin:/Users/en/.rvm/gems/ruby-3.2.2/bin:/Users/en/.rvm/gems/ruby-3.2.2@global/bin:/Users/en/.rvm/rubies/ruby-3.2.2/bin:/usr/local/sbin:~/go/bin:/Users/en/Development/Centrilogic/CAGE/tools:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Applications/Little Snitch.app/Contents/Components:/Applications/VMware Fusion.app/Contents/Public:/usr/local/go/bin:/Users/en/.rvm/bin:/Users/en/go/bin:/Users/en/.npm-global/bin:/Library/Frameworks/Python.framework/Versions/3.10/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Applications/Sublime Text.app/Contents/SharedSupport/bin:/Users/en/.rvm/gems/ruby-3.2.2/bin:/Users/en/.rvm/gems/ruby-3.2.2@global/bin:/Users/en/.rvm/rubies/ruby-3.2.2/bin:/usr/local/sbin:~/go/bin:/Users/en/Development/Centrilogic/CAGE/tools:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Applications/Little Snitch.app/Contents/Components:/Applications/VMware Fusion.app/Contents/Public:/usr/local/go/bin:/Users/en/.rvm/bin
	GVM_ROOT=/Users/en/.gvm
	GVM_VERSION=1.0.22
	HOME=/Users/en
	HOMEBREW_CELLAR=/opt/homebrew/Cellar
	HOMEBREW_PREFIX=/opt/homebrew
	HOMEBREW_REPOSITORY=/opt/homebrew
	INFOPATH=/opt/homebrew/share/info:
	IRBRC=/Users/en/.rvm/rubies/ruby-3.2.2/.irbrc
	ITERM_ORIG_PS1=(beeware-venv) \[\e[0;1;38;5;40m\]\u\[\e[0;38;5;45m\]@\[\e[0;38;5;111m\]\h\[\e[0;38;5;255m\]:\[\e[0;38;5;203m\]\w\[\e[0;38;5;40m\]\$\[\e[0m\]
	ITERM_PREV_PS1=\[]133;D;$?]133;A\](beeware-venv) \[\e[0;1;38;5;40m\]\u\[\e[0;38;5;45m\]@\[\e[0;38;5;111m\]\h\[\e[0;38;5;255m\]:\[\e[0;38;5;203m\]\w\[\e[0;38;5;40m\]\$\[\e[0m\]\[]133;B\]
	ITERM_PROFILE=Default
	ITERM_SESSION_ID=w0t5p0:AE259B26-4A8E-467B-92EB-4E81C3120ACA
	JAVA_HOME=/opt/homebrew/Cellar/openjdk/23/libexec/openjdk.jdk/Contents/Home
	LANG=en_CA.UTF-8
	LC_TERMINAL=iTerm2
	LC_TERMINAL_VERSION=3.4.16
	LIBRARY_PATH=/opt/homebrew/lib
	LOGNAME=en
	LSCOLORS=GxFxCxDxBxegedabagaced
	LaunchInstanceID=48DFAC11-173A-4449-B133-C89A54682BCA
	MY_RUBY_HOME=/Users/en/.rvm/rubies/ruby-3.2.2
	OLDPWD=/Users/en/beeware-tutorial
	PATH=/Users/en/beeware-tutorial/beeware-venv/bin:/Users/en/Downloads/google-cloud-sdk/bin:/Users/en/.gvm/bin:/opt/homebrew/Cellar/openjdk/21.0.2/libexec/openjdk.jdk/Contents/Home/bin:~/.bin:/Library/Frameworks/Python.framework/Versions/3.10/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Applications/Sublime Text.app/Contents/SharedSupport/bin:/Users/en/.rvm/gems/ruby-3.2.2/bin:/Users/en/.rvm/gems/ruby-3.2.2@global/bin:/Users/en/.rvm/rubies/ruby-3.2.2/bin:/usr/local/sbin:~/go/bin:/Users/en/Development/Centrilogic/CAGE/tools:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Applications/Little Snitch.app/Contents/Components:/Applications/VMware Fusion.app/Contents/Public:/usr/local/go/bin:/Users/en/.rvm/bin:/Users/en/go/bin:/Users/en/.npm-global/bin:/Library/Frameworks/Python.framework/Versions/3.10/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Applications/Sublime Text.app/Contents/SharedSupport/bin:/Users/en/.rvm/gems/ruby-3.2.2/bin:/Users/en/.rvm/gems/ruby-3.2.2@global/bin:/Users/en/.rvm/rubies/ruby-3.2.2/bin:/usr/local/sbin:~/go/bin:/Users/en/Development/Centrilogic/CAGE/tools:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Applications/Little Snitch.app/Contents/Components:/Applications/VMware Fusion.app/Contents/Public:/usr/local/go/bin:/Users/en/.rvm/bin:/Users/en/.pulumi/bin
	PS1=(beeware-venv) \[\e[0;1;38;5;40m\]\u\[\e[0;38;5;45m\]@\[\e[0;38;5;111m\]\h\[\e[0;38;5;255m\]:\[\e[0;38;5;203m\]\w\[\e[0;38;5;40m\]\$\[\e[0m\]
	PWD=/Users/en/beeware-tutorial/helloworld
	RUBYMOTION_ANDROID_NDK=/Users/en/.rubymotion-android/ndk
	RUBYMOTION_ANDROID_SDK=/Users/en/.rubymotion-android/sdk
	RUBY_VERSION=ruby-3.2.2
	SECURITYSESSIONID=186a2
	SHELL=/bin/bash
	SHLVL=1
	SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.4yW4l5mR8J/Listeners
	TERM=xterm-256color
	TERM_PROGRAM=iTerm.app
	TERM_PROGRAM_VERSION=3.4.16
	TERM_SESSION_ID=w0t5p0:AE259B26-4A8E-467B-92EB-4E81C3120ACA
	TMPDIR=/var/folders/hh/021mzlfn67l6ff3ggz8pt88c0000gn/T/
	USER=en
	VIRTUAL_ENV=/Users/en/beeware-tutorial/beeware-venv
	VIRTUAL_ENV_PROMPT=(beeware-venv) 
	XPC_FLAGS=0x0
	XPC_SERVICE_NAME=0
	_=/Users/en/beeware-tutorial/beeware-venv/bin/briefcase
	__CFBundleIdentifier=com.googlecode.iterm2
	__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x52
	rvm_bin_path=/Users/en/.rvm/bin
	rvm_path=/Users/en/.rvm
	rvm_prefix=/Users/en
	rvm_version=1.29.12 (latest)

pyproject.toml:
# This project was generated with 0.3.20 using template: /Users/en/briefcase-template@v0.3.20
[tool.briefcase]
project_name = "Hello World"
bundle = "com.example"
version = "0.0.1"
url = "https://example.com/helloworld"
license.file = "Other"
author = "Jane Developer"
author_email = "jane@example.com"


[tool.briefcase.app.helloworld]
formal_name = "Hello World"
description = "My first application"
long_description = """More details about the app should go here.
"""
sources = [
    "src/helloworld",
]
test_sources = [
    "tests",
]

requires = [
]
test_requires = [
    "pytest",
]

[tool.briefcase.app.helloworld.macOS]
universal_build = true
requires = [
    "toga-cocoa~=0.4.7",
    "std-nslog~=1.0.3",
]

[tool.briefcase.app.helloworld.linux]
requires = [
    "toga-gtk~=0.4.7",
]

[tool.briefcase.app.helloworld.linux.system.debian]
system_requires = [
    # Needed to compile pycairo wheel
    "libcairo2-dev",
    # Needed to compile PyGObject wheel
    "libgirepository1.0-dev",
]

system_runtime_requires = [
    # Needed to provide GTK and its GI bindings
    "gir1.2-gtk-3.0",
    "libgirepository-1.0-1",
    # Dependencies that GTK looks for at runtime
    "libcanberra-gtk3-module",
    # Needed to provide WebKit2 at runtime
    # Note: Debian 11 and Ubuntu 20.04 require gir1.2-webkit2-4.0 instead
    # "gir1.2-webkit2-4.1",
]

[tool.briefcase.app.helloworld.linux.system.rhel]
system_requires = [
    # Needed to compile pycairo wheel
    "cairo-gobject-devel",
    # Needed to compile PyGObject wheel
    "gobject-introspection-devel",
]

system_runtime_requires = [
    # Needed to support Python bindings to GTK
    "gobject-introspection",
    # Needed to provide GTK
    "gtk3",
    # Dependencies that GTK looks for at runtime
    "libcanberra-gtk3",
    # Needed to provide WebKit2 at runtime
    # "webkit2gtk3",
]

[tool.briefcase.app.helloworld.linux.system.suse]
system_requires = [
    # Needed to compile pycairo wheel
    "cairo-devel",
    # Needed to compile PyGObject wheel
    "gobject-introspection-devel",
]

system_runtime_requires = [
    # Needed to provide GTK
    "gtk3",
    # Needed to support Python bindings to GTK
    "gobject-introspection", "typelib(Gtk) = 3.0",
    # Dependencies that GTK looks for at runtime
    "libcanberra-gtk3-module",
    # Needed to provide WebKit2 at runtime
    # "libwebkit2gtk3", "typelib(WebKit2)",
]

[tool.briefcase.app.helloworld.linux.system.arch]
system_requires = [
    # Needed to compile pycairo wheel
    "cairo",
    # Needed to compile PyGObject wheel
    "gobject-introspection",
    # Runtime dependencies that need to exist so that the
    # Arch package passes final validation.
    # Needed to provide GTK
    "gtk3",
    # Dependencies that GTK looks for at runtime
    "libcanberra",
    # Needed to provide WebKit2
    # "webkit2gtk",
]

system_runtime_requires = [
    # Needed to provide GTK
    "gtk3",
    # Needed to provide PyGObject bindings
    "gobject-introspection-runtime",
    # Dependencies that GTK looks for at runtime
    "libcanberra",
    # Needed to provide WebKit2 at runtime
    # "webkit2gtk",
]

[tool.briefcase.app.helloworld.linux.appimage]
manylinux = "manylinux_2_28"

system_requires = [
    # Needed to compile pycairo wheel
    "cairo-gobject-devel",
    # Needed to compile PyGObject wheel
    "gobject-introspection-devel",
    # Needed to provide GTK
    "gtk3-devel",
    # Dependencies that GTK looks for at runtime, that need to be
    # in the build environment to be picked up by linuxdeploy
    "libcanberra-gtk3",
    "PackageKit-gtk3-module",
    "gvfs-client",
]

linuxdeploy_plugins = [
    "DEPLOY_GTK_VERSION=3 gtk",
]

[tool.briefcase.app.helloworld.linux.flatpak]
flatpak_runtime = "org.gnome.Platform"
flatpak_runtime_version = "47"
flatpak_sdk = "org.gnome.Sdk"

[tool.briefcase.app.helloworld.windows]
requires = [
    "toga-winforms~=0.4.7",
]

# Mobile deployments
[tool.briefcase.app.helloworld.iOS]
requires = [
    "toga-iOS~=0.4.7",
    "std-nslog~=1.0.3",
]

[tool.briefcase.app.helloworld.android]
requires = [
    "toga-android~=0.4.7",
]


base_theme = "Theme.MaterialComponents.Light.DarkActionBar"

build_gradle_dependencies = [
    "com.google.android.material:material:1.12.0",
    # Needed for DetailedList
    # "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
    # Needed for MapView
    # "org.osmdroid:osmdroid-android:6.1.20",
]

# Web deployments
[tool.briefcase.app.helloworld.web]
requires = [
    "toga-web~=0.4.7",
]
style_framework = "Shoelace v2.3"

Briefcase Log:
[07:19:25]                                                                                                                                                             create.py:884
           [helloworld] Generating application template...                                                                                                             create.py:884
           Using app template: https://github.com/beeware/briefcase-macOS-app-template.git, branch v0.3.20                                                              base.py:1115
           Cloning template 'https://github.com/beeware/briefcase-macOS-app-template.git'...                                                                             base.py:959
[07:19:26]                                                                                                                                                            __main__.py:44
           Unable to check out template branch.                                                                                                                       __main__.py:45
                                                                                                                                                                      __main__.py:45
           This may be because your computer is offline, or because the template repository                                                                           __main__.py:45
           is in a weird state. If you have a stable network connection, try deleting:                                                                                __main__.py:45
                                                                                                                                                                      __main__.py:45
               /Users/en/Library/Caches/org.beeware.briefcase/templates/briefcase-macOS-app-template                                                                  __main__.py:45
                                                                                                                                                                      __main__.py:45
           and retrying your command.                                                                                                                                 __main__.py:45
           Saving log... started                                                                                                                                      console.py:391

Main thread traceback:
╭─────────────────────────────────────────────────────────────────────── Traceback (most recent call last) ────────────────────────────────────────────────────────────────────────╮
│ /Users/en/beeware-tutorial/beeware-venv/lib/python3.10/site-packages/briefcase/commands/base.py:993 in update_cookiecutter_cache                    │
│                                                                                                                                                                                  │
│    990 │   │   │   │   # Ensure the existing repo's origin URL points to the location                                                                                            │
│    991 │   │   │   │   # being requested. A difference can occur, for instance, if a                                                                                             │
│    992 │   │   │   │   # fork of the template is used.                                                                                                                           │
│ ❱  993 │   │   │   │   remote.set_url(new_url=template, old_url=remote.url)                                                                                                      │
│    994 │   │   │   │   try:                                                                                                                                                      │
│    995 │   │   │   │   │   # Attempt to update the repository                                                                                                                    │
│    996 │   │   │   │   │   remote.fetch()                                                                                                                                        │
│                                                                                                                                                                                  │
│ ╭────────────────────────────────────────────────────────────── locals ───────────────────────────────────────────────────────────────╮                                          │
│ │          branch = 'v0.3.20'                                                                                                         │                                          │
│ │ cached_template = PosixPath('/Users/en/Library/Caches/org.beeware.briefcase/templates/briefcase-macOS-app-template')                │                                          │
│ │          remote = <git.Remote "origin">                                                                                             │                                          │
│ │            repo = <git.repo.base.Repo '/Users/en/Library/Caches/org.beeware.briefcase/templates/briefcase-macOS-app-template/.git'> │                                          │
│ │            self = <briefcase.platforms.macOS.app.macOSAppCreateCommand object at 0x106472080>                                       │                                          │
│ │        template = 'https://github.com/beeware/briefcase-macOS-app-template.git'                                                     │                                          │
│ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯                                          │
│                                                                                                                                                                                  │
│ /Users/en/beeware-tutorial/beeware-venv/lib/python3.10/site-packages/git/remote.py:662 in set_url                                                   │
│                                                                                                                                                                                  │
│    659 │   │   scmd = "set-url"                                                                                                                                                  │
│    660 │   │   kwargs["insert_kwargs_after"] = scmd                                                                                                                              │
│    661 │   │   if old_url:                                                                                                                                                       │
│ ❱  662 │   │   │   self.repo.git.remote(scmd, "--", self.name, new_url, old_url, **kwargs)                                                                                       │
│    663 │   │   else:                                                                                                                                                             │
│    664 │   │   │   self.repo.git.remote(scmd, "--", self.name, new_url, **kwargs)                                                                                                │
│    665 │   │   return self                                                                                                                                                       │
│                                                                                                                                                                                  │
│ ╭──────────────────────────────────────── locals ────────────────────────────────────────╮                                                                                       │
│ │ allow_unsafe_protocols = False                                                         │                                                                                       │
│ │                 kwargs = {'insert_kwargs_after': 'set-url'}                            │                                                                                       │
│ │                new_url = 'https://github.com/beeware/briefcase-macOS-app-template.git' │                                                                                       │
│ │                old_url = 'https://github.com/beeware/briefcase-macOS-app-template.git' │                                                                                       │
│ │                   scmd = 'set-url'                                                     │                                                                                       │
│ │                   self = <git.Remote "origin">                                         │                                                                                       │
│ ╰────────────────────────────────────────────────────────────────────────────────────────╯                                                                                       │
│                                                                                                                                                                                  │
│ /Users/en/beeware-tutorial/beeware-venv/lib/python3.10/site-packages/git/cmd.py:986 in <lambda>                                                     │
│                                                                                                                                                                                  │
│    983 │   │   """                                                                                                                                                               │
│    984 │   │   if name.startswith("_"):                                                                                                                                          │
│    985 │   │   │   return super().__getattribute__(name)                                                                                                                         │
│ ❱  986 │   │   return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)                                                                                          │
│    987 │                                                                                                                                                                         │
│    988 │   def set_persistent_git_options(self, **kwargs: Any) -> None:                                                                                                          │
│    989 │   │   """Specify command line options to the git executable for subsequent                                                                                              │
│                                                                                                                                                                                  │
│ ╭────────────────────────────────────────────────────────────────────────────── locals ──────────────────────────────────────────────────────────────────────────────╮           │
│ │   args = ('set-url', '--', 'origin', 'https://github.com/beeware/briefcase-macOS-app-template.git', 'https://github.com/beeware/briefcase-macOS-app-template.git') │           │
│ │ kwargs = {'insert_kwargs_after': 'set-url'}                                                                                                                        │           │
│ │   name = 'remote'                                                                                                                                                  │           │
│ │   self = <git.cmd.Git object at 0x1067592a0>                                                                                                                       │           │
│ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯           │
│                                                                                                                                                                                  │
│ /Users/en/beeware-tutorial/beeware-venv/lib/python3.10/site-packages/git/cmd.py:1598 in _call_process                                               │
│                                                                                                                                                                                  │
│   1595 │   │   call.append(dashify(method))                                                                                                                                      │
│   1596 │   │   call.extend(args_list)                                                                                                                                            │
│   1597 │   │                                                                                                                                                                     │
│ ❱ 1598 │   │   return self.execute(call, **exec_kwargs)                                                                                                                          │
│   1599 │                                                                                                                                                                         │
│   1600 │   def _parse_object_header(self, header_line: str) -> Tuple[str, str, int]:                                                                                             │
│   1601 │   │   """                                                                                                                                                               │
│                                                                                                                                                                                  │
│ ╭────────────────────────────────────────── locals ──────────────────────────────────────────╮                                                                                   │
│ │                  args = (                                                                  │                                                                                   │
│ │                         │   'set-url',                                                     │                                                                                   │
│ │                         │   '--',                                                          │                                                                                   │
│ │                         │   'origin',                                                      │                                                                                   │
│ │                         │   'https://github.com/beeware/briefcase-macOS-app-template.git', │                                                                                   │
│ │                         │   'https://github.com/beeware/briefcase-macOS-app-template.git'  │                                                                                   │
│ │                         )                                                                  │                                                                                   │
│ │             args_list = [                                                                  │                                                                                   │
│ │                         │   'set-url',                                                     │                                                                                   │
│ │                         │   '--',                                                          │                                                                                   │
│ │                         │   'origin',                                                      │                                                                                   │
│ │                         │   'https://github.com/beeware/briefcase-macOS-app-template.git', │                                                                                   │
│ │                         │   'https://github.com/beeware/briefcase-macOS-app-template.git'  │                                                                                   │
│ │                         ]                                                                  │                                                                                   │
│ │                  call = [                                                                  │                                                                                   │
│ │                         │   'git',                                                         │                                                                                   │
│ │                         │   'remote',                                                      │                                                                                   │
│ │                         │   'set-url',                                                     │                                                                                   │
│ │                         │   '--',                                                          │                                                                                   │
│ │                         │   'origin',                                                      │                                                                                   │
│ │                         │   'https://github.com/beeware/briefcase-macOS-app-template.git', │                                                                                   │
│ │                         │   'https://github.com/beeware/briefcase-macOS-app-template.git'  │                                                                                   │
│ │                         ]                                                                  │                                                                                   │
│ │           exec_kwargs = {}                                                                 │                                                                                   │
│ │              ext_args = [                                                                  │                                                                                   │
│ │                         │   'set-url',                                                     │                                                                                   │
│ │                         │   '--',                                                          │                                                                                   │
│ │                         │   'origin',                                                      │                                                                                   │
│ │                         │   'https://github.com/beeware/briefcase-macOS-app-template.git', │                                                                                   │
│ │                         │   'https://github.com/beeware/briefcase-macOS-app-template.git'  │                                                                                   │
│ │                         ]                                                                  │                                                                                   │
│ │                 index = 0                                                                  │                                                                                   │
│ │ insert_after_this_arg = 'set-url'                                                          │                                                                                   │
│ │                kwargs = {'insert_kwargs_after': 'set-url'}                                 │                                                                                   │
│ │                method = 'remote'                                                           │                                                                                   │
│ │              opt_args = []                                                                 │                                                                                   │
│ │           opts_kwargs = {}                                                                 │                                                                                   │
│ │                  self = <git.cmd.Git object at 0x1067592a0>                                │                                                                                   │
│ ╰────────────────────────────────────────────────────────────────────────────────────────────╯                                                                                   │
│                                                                                                                                                                                  │
│ /Users/en/beeware-tutorial/beeware-venv/lib/python3.10/site-packages/git/cmd.py:1388 in execute                                                     │
│                                                                                                                                                                                  │
│   1385 │   │   # END handle debug printing                                                                                                                                       │
│   1386 │   │                                                                                                                                                                     │
│   1387 │   │   if with_exceptions and status != 0:                                                                                                                               │
│ ❱ 1388 │   │   │   raise GitCommandError(redacted_command, status, stderr_value, stdout_value)                                                                                   │
│   1389 │   │                                                                                                                                                                     │
│   1390 │   │   if isinstance(stdout_value, bytes) and stdout_as_string:  # Could also be output                                                                                  │
│   1391 │   │   │   stdout_value = safe_decode(stdout_value)                                                                                                                      │
│                                                                                                                                                                                  │
│ ╭──────────────────────────────────────────────────────────────────── locals ────────────────────────────────────────────────────────────────────╮                               │
│ │              as_process = False                                                                                                                │                               │
│ │                 command = [                                                                                                                    │                               │
│ │                           │   'git',                                                                                                           │                               │
│ │                           │   'remote',                                                                                                        │                               │
│ │                           │   'set-url',                                                                                                       │                               │
│ │                           │   '--',                                                                                                            │                               │
│ │                           │   'origin',                                                                                                        │                               │
│ │                           │   'https://github.com/beeware/briefcase-macOS-app-template.git',                                                   │                               │
│ │                           │   'https://github.com/beeware/briefcase-macOS-app-template.git'                                                    │                               │
│ │                           ]                                                                                                                    │                               │
│ │             communicate = <bound method Popen.communicate of <Popen: returncode: 128 args: ['git', 'remote', 'set-url', '--', 'origin', '...>> │                               │
│ │                     cwd = '/Users/en/Library/Caches/org.beeware.briefcase/templates/briefcase-macOS-app-tem'+5                                 │                               │
│ │                     env = {                                                                                                                    │                               │
│ │                           │   'GREP_COLOR': '1;35;40',                                                                                         │                               │
│ │                           │   'rvm_bin_path': '/Users/en/.rvm/bin',                                                                            │                               │
│ │                           │   'TERM_PROGRAM': 'iTerm.app',                                                                                     │                               │
│ │                           │   'GEM_HOME': '/Users/en/.rvm/gems/ruby-3.2.2',                                                                    │                               │
│ │                           │   'TERM': 'xterm-256color',                                                                                        │                               │
│ │                           │   'SHELL': '/bin/bash',                                                                                            │                               │
│ │                           │   'CLICOLOR': '1',                                                                                                 │                               │
│ │                           │   'HOMEBREW_REPOSITORY': '/opt/homebrew',                                                                          │                               │
│ │                           │   'IRBRC': '/Users/en/.rvm/rubies/ruby-3.2.2/.irbrc',                                                              │                               │
│ │                           │   'TMPDIR': '/var/folders/hh/021mzlfn67l6ff3ggz8pt88c0000gn/T/',                                                   │                               │
│ │                           │   ... +52                                                                                                          │                               │
│ │                           }                                                                                                                    │                               │
│ │              inline_env = None                                                                                                                 │                               │
│ │                 istream = None                                                                                                                 │                               │
│ │      kill_after_timeout = None                                                                                                                 │                               │
│ │          max_chunk_size = 8192                                                                                                                 │                               │
│ │                 newline = b'\n'                                                                                                                │                               │
│ │           output_stream = None                                                                                                                 │                               │
│ │                    proc = <Popen: returncode: 128 args: ['git', 'remote', 'set-url', '--', 'origin', '...>                                     │                               │
│ │        redacted_command = [                                                                                                                    │                               │
│ │                           │   'git',                                                                                                           │                               │
│ │                           │   'remote',                                                                                                        │                               │
│ │                           │   'set-url',                                                                                                       │                               │
│ │                           │   '--',                                                                                                            │                               │
│ │                           │   'origin',                                                                                                        │                               │
│ │                           │   'https://github.com/beeware/briefcase-macOS-app-template.git',                                                   │                               │
│ │                           │   'https://github.com/beeware/briefcase-macOS-app-template.git'                                                    │                               │
│ │                           ]                                                                                                                    │                               │
│ │                    self = <git.cmd.Git object at 0x1067592a0>                                                                                  │                               │
│ │                   shell = False                                                                                                                │                               │
│ │                  status = 128                                                                                                                  │                               │
│ │            stderr_value = b'fatal: No such URL found: https://github.com/beeware/briefcase-macOS-app-templat'+5                                │                               │
│ │        stdout_as_string = True                                                                                                                 │                               │
│ │             stdout_sink = -1                                                                                                                   │                               │
│ │            stdout_value = b''                                                                                                                  │                               │
│ │ strip_newline_in_stdout = True                                                                                                                 │                               │
│ │       subprocess_kwargs = {}                                                                                                                   │                               │
│ │      universal_newlines = False                                                                                                                │                               │
│ │         with_exceptions = True                                                                                                                 │                               │
│ │    with_extended_output = False                                                                                                                │                               │
│ │             with_stdout = True                                                                                                                 │                               │
│ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯                               │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
GitCommandError: Cmd('git') failed due to: exit code(128)
  cmdline: git remote set-url -- origin https://github.com/beeware/briefcase-macOS-app-template.git https://github.com/beeware/briefcase-macOS-app-template.git
  stderr: 'fatal: No such URL found: https://github.com/beeware/briefcase-macOS-app-template.git'

The above exception was the direct cause of the following exception:

╭─────────────────────────────────────────────────────────────────────── Traceback (most recent call last) ────────────────────────────────────────────────────────────────────────╮
│ /Users/en/beeware-tutorial/beeware-venv/lib/python3.10/site-packages/briefcase/__main__.py:29 in main                                               │
│                                                                                                                                                                                  │
│   26 │   │   │   Path.cwd() / "pyproject.toml",                                                                                                                                  │
│   27 │   │   │   overrides=overrides,                                                                                                                                            │
│   28 │   │   )                                                                                                                                                                   │
│ ❱ 29 │   │   command(**options)                                                                                                                                                  │
│   30 │   except HelpText as e:                                                                                                                                                   │
│   31 │   │   logger.info()                                                                                                                                                       │
│   32 │   │   logger.info(str(e))                                                                                                                                                 │
│                                                                                                                                                                                  │
│ ╭─────────────────────────────────────────────────────────────────────────────────── locals ───────────────────────────────────────────────────────────────────────────────────╮ │
│ │       command = <briefcase.platforms.macOS.app.macOSAppCreateCommand object at 0x106472080>                                                                                  │ │
│ │       console = <briefcase.console.Console object at 0x106419ae0>                                                                                                            │ │
│ │             e = BriefcaseCommandError('Unable to check out template branch.\n\nThis may be because your computer is offline, or because the template repository\nis in a     │ │
│ │                 weird state. If you have a stable network connection, try deleting:\n\n                                                                                      │ │
│ │                 /Users/en/Library/Caches/org.beeware.briefcase/templates/briefcase-macOS-app-template\n\nand retrying your command.')                                        │ │
│ │ extra_cmdline = []                                                                                                                                                           │ │
│ │        logger = <briefcase.console.Log object at 0x106419b40>                                                                                                                │ │
│ │       options = {}                                                                                                                                                           │ │
│ │     overrides = {}                                                                                                                                                           │ │
│ │       printer = <briefcase.console.Printer object at 0x104be03d0>                                                                                                            │ │
│ │        result = 200                                                                                                                                                          │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                                                                                                  │
│ /Users/en/beeware-tutorial/beeware-venv/lib/python3.10/site-packages/briefcase/commands/create.py:949 in __call__                                   │
│                                                                                                                                                                                  │
│   946 │   │   else:                                                                                                                                                              │
│   947 │   │   │   state = None                                                                                                                                                   │
│   948 │   │   │   for app_name, app in sorted(self.apps.items()):                                                                                                                │
│ ❱ 949 │   │   │   │   state = self.create_app(app, **full_options(state, options))                                                                                               │
│   950 │   │                                                                                                                                                                      │
│   951 │   │   return state                                                                                                                                                       │
│   952                                                                                                                                                                            │
│                                                                                                                                                                                  │
│ ╭──────────────────────────────────────── locals ────────────────────────────────────────╮                                                                                       │
│ │      app = <com.example.helloworld v0.0.1 AppConfig>                                   │                                                                                       │
│ │ app_name = 'helloworld'                                                                │                                                                                       │
│ │  options = {}                                                                          │                                                                                       │
│ │     self = <briefcase.platforms.macOS.app.macOSAppCreateCommand object at 0x106472080> │                                                                                       │
│ │    state = None                                                                        │                                                                                       │
│ ╰────────────────────────────────────────────────────────────────────────────────────────╯                                                                                       │
│                                                                                                                                                                                  │
│ /Users/en/beeware-tutorial/beeware-venv/lib/python3.10/site-packages/briefcase/commands/create.py:885 in create_app                                 │
│                                                                                                                                                                                  │
│   882 │   │   │   self.tools.shutil.rmtree(bundle_path)                                                                                                                          │
│   883 │   │                                                                                                                                                                      │
│   884 │   │   self.logger.info("Generating application template...", prefix=app.app_name)                                                                                        │
│ ❱ 885 │   │   self.generate_app_template(app=app)                                                                                                                                │
│   886 │   │                                                                                                                                                                      │
│   887 │   │   self.logger.info("Installing support package...", prefix=app.app_name)                                                                                             │
│   888 │   │   self.install_app_support_package(app=app)                                                                                                                          │
│                                                                                                                                                                                  │
│ ╭───────────────────────────────────────────────────────── locals ─────────────────────────────────────────────────────────╮                                                     │
│ │         app = <com.example.helloworld v0.0.1 AppConfig>                                                                  │                                                     │
│ │ bundle_path = PosixPath('/Users/en/beeware-tutorial/helloworld/build/helloworld/macos/app') │                                                     │
│ │     options = {}                                                                                                         │                                                     │
│ │        self = <briefcase.platforms.macOS.app.macOSAppCreateCommand object at 0x106472080>                                │                                                     │
│ │   test_mode = False                                                                                                      │                                                     │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯                                                     │
│                                                                                                                                                                                  │
│ /Users/en/beeware-tutorial/beeware-venv/lib/python3.10/site-packages/briefcase/commands/create.py:255 in generate_app_template                      │
│                                                                                                                                                                                  │
│   252 │   │   output_path = self.bundle_path(app).parent                                                                                                                         │
│   253 │   │   output_path.mkdir(parents=True, exist_ok=True)                                                                                                                     │
│   254 │   │                                                                                                                                                                      │
│ ❱ 255 │   │   self.generate_template(                                                                                                                                            │
│   256 │   │   │   template=app.template if app.template else self.app_template_url,                                                                                              │
│   257 │   │   │   branch=app.template_branch,                                                                                                                                    │
│   258 │   │   │   output_path=output_path,                                                                                                                                       │
│                                                                                                                                                                                  │
│ ╭──────────────────────────────────────────────────────── locals ────────────────────────────────────────────────────────╮                                                       │
│ │           app = <com.example.helloworld v0.0.1 AppConfig>                                                              │                                                       │
│ │ extra_context = {                                                                                                      │                                                       │
│ │                 │   'project_name': 'Hello World',                                                                     │                                                       │
│ │                 │   'universal_build': True,                                                                           │                                                       │
│ │                 │   'app_name': 'helloworld',                                                                          │                                                       │
│ │                 │   'version': '0.0.1',                                                                                │                                                       │
│ │                 │   'bundle': 'com.example',                                                                           │                                                       │
│ │                 │   'description': 'My first application',                                                             │                                                       │
│ │                 │   'sources': ['src/helloworld'],                                                                     │                                                       │
│ │                 │   'formal_name': 'Hello World',                                                                      │                                                       │
│ │                 │   'url': 'https://example.com/helloworld',                                                           │                                                       │
│ │                 │   'author': 'Jane Developer',                                                                        │                                                       │
│ │                 │   ... +21                                                                                            │                                                       │
│ │                 }                                                                                                      │                                                       │
│ │   output_path = PosixPath('/Users/en/beeware-tutorial/helloworld/build/helloworld/macos') │                                                       │
│ │          self = <briefcase.platforms.macOS.app.macOSAppCreateCommand object at 0x106472080>                            │                                                       │
│ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯                                                       │
│                                                                                                                                                                                  │
│ /Users/en/beeware-tutorial/beeware-venv/lib/python3.10/site-packages/briefcase/commands/base.py:1119 in generate_template                           │
│                                                                                                                                                                                  │
│   1116 │   │   │   │   f"Using app template: {template}, branch {template_branch}"                                                                                               │
│   1117 │   │   │   )                                                                                                                                                             │
│   1118 │   │   │   # Unroll the new app template                                                                                                                                 │
│ ❱ 1119 │   │   │   self._generate_template(                                                                                                                                      │
│   1120 │   │   │   │   template=template,                                                                                                                                        │
│   1121 │   │   │   │   branch=template_branch,                                                                                                                                   │
│   1122 │   │   │   │   output_path=output_path,                                                                                                                                  │
│                                                                                                                                                                                  │
│ ╭───────────────────────────────────────────────────────── locals ─────────────────────────────────────────────────────────╮                                                     │
│ │          branch = None                                                                                                   │                                                     │
│ │   extra_context = {                                                                                                      │                                                     │
│ │                   │   'project_name': 'Hello World',                                                                     │                                                     │
│ │                   │   'universal_build': True,                                                                           │                                                     │
│ │                   │   'app_name': 'helloworld',                                                                          │                                                     │
│ │                   │   'version': '0.0.1',                                                                                │                                                     │
│ │                   │   'bundle': 'com.example',                                                                           │                                                     │
│ │                   │   'description': 'My first application',                                                             │                                                     │
│ │                   │   'sources': ['src/helloworld'],                                                                     │                                                     │
│ │                   │   'formal_name': 'Hello World',                                                                      │                                                     │
│ │                   │   'url': 'https://example.com/helloworld',                                                           │                                                     │
│ │                   │   'author': 'Jane Developer',                                                                        │                                                     │
│ │                   │   ... +24                                                                                            │                                                     │
│ │                   }                                                                                                      │                                                     │
│ │     output_path = PosixPath('/Users/en/beeware-tutorial/helloworld/build/helloworld/macos') │                                                     │
│ │            self = <briefcase.platforms.macOS.app.macOSAppCreateCommand object at 0x106472080>                            │                                                     │
│ │        template = 'https://github.com/beeware/briefcase-macOS-app-template.git'                                          │                                                     │
│ │ template_branch = 'v0.3.20'                                                                                              │                                                     │
│ │         version = <Version('0.3.20')>                                                                                    │                                                     │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯                                                     │
│                                                                                                                                                                                  │
│ /Users/en/beeware-tutorial/beeware-venv/lib/python3.10/site-packages/briefcase/commands/base.py:1056 in _generate_template                          │
│                                                                                                                                                                                  │
│   1053 │   │   """                                                                                                                                                               │
│   1054 │   │   # Make sure we have an updated cookiecutter template,                                                                                                             │
│   1055 │   │   # checked out to the right branch                                                                                                                                 │
│ ❱ 1056 │   │   cached_template = self.update_cookiecutter_cache(                                                                                                                 │
│   1057 │   │   │   template=template,                                                                                                                                            │
│   1058 │   │   │   branch=branch,                                                                                                                                                │
│   1059 │   │   )                                                                                                                                                                 │
│                                                                                                                                                                                  │
│ ╭──────────────────────────────────────────────────────── locals ────────────────────────────────────────────────────────╮                                                       │
│ │        branch = 'v0.3.20'                                                                                              │                                                       │
│ │ extra_context = {                                                                                                      │                                                       │
│ │                 │   'project_name': 'Hello World',                                                                     │                                                       │
│ │                 │   'universal_build': True,                                                                           │                                                       │
│ │                 │   'app_name': 'helloworld',                                                                          │                                                       │
│ │                 │   'version': '0.0.1',                                                                                │                                                       │
│ │                 │   'bundle': 'com.example',                                                                           │                                                       │
│ │                 │   'description': 'My first application',                                                             │                                                       │
│ │                 │   'sources': ['src/helloworld'],                                                                     │                                                       │
│ │                 │   'formal_name': 'Hello World',                                                                      │                                                       │
│ │                 │   'url': 'https://example.com/helloworld',                                                           │                                                       │
│ │                 │   'author': 'Jane Developer',                                                                        │                                                       │
│ │                 │   ... +24                                                                                            │                                                       │
│ │                 }                                                                                                      │                                                       │
│ │   output_path = PosixPath('/Users/en/beeware-tutorial/helloworld/build/helloworld/macos') │                                                       │
│ │          self = <briefcase.platforms.macOS.app.macOSAppCreateCommand object at 0x106472080>                            │                                                       │
│ │      template = 'https://github.com/beeware/briefcase-macOS-app-template.git'                                          │                                                       │
│ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯                                                       │
│                                                                                                                                                                                  │
│ /Users/en/beeware-tutorial/beeware-venv/lib/python3.10/site-packages/briefcase/commands/base.py:1029 in update_cookiecutter_cache                   │
│                                                                                                                                                                                  │
│   1026 │   │   │   │   │   # No branch exists for the requested version.                                                                                                         │
│   1027 │   │   │   │   │   raise TemplateUnsupportedVersion(branch) from e                                                                                                       │
│   1028 │   │   │   except (ValueError, self.tools.git.exc.GitError) as e:                                                                                                        │
│ ❱ 1029 │   │   │   │   raise BriefcaseCommandError(                                                                                                                              │
│   1030 │   │   │   │   │   "Unable to check out template branch.\n"                                                                                                              │
│   1031 │   │   │   │   │   "\n"                                                                                                                                                  │
│   1032 │   │   │   │   │   "This may be because your computer is offline, or because the templa                                                                                  │
│                                                                                                                                                                                  │
│ ╭────────────────────────────────────────────────────────────── locals ───────────────────────────────────────────────────────────────╮                                          │
│ │          branch = 'v0.3.20'                                                                                                         │                                          │
│ │ cached_template = PosixPath('/Users/en/Library/Caches/org.beeware.briefcase/templates/briefcase-macOS-app-template')                │                                          │
│ │          remote = <git.Remote "origin">                                                                                             │                                          │
│ │            repo = <git.repo.base.Repo '/Users/en/Library/Caches/org.beeware.briefcase/templates/briefcase-macOS-app-template/.git'> │                                          │
│ │            self = <briefcase.platforms.macOS.app.macOSAppCreateCommand object at 0x106472080>                                       │                                          │
│ │        template = 'https://github.com/beeware/briefcase-macOS-app-template.git'                                                     │                                          │
│ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯                                          │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
BriefcaseCommandError: Unable to check out template branch.

This may be because your computer is offline, or because the template repository
is in a weird state. If you have a stable network connection, try deleting:

    /Users/en/Library/Caches/org.beeware.briefcase/templates/briefcase-macOS-app-template

and retrying your command.
```

</details>
Thanks for the additional information.

Below is the important part of your log:
```
GitCommandError: Cmd('git') failed due to: exit code(128)
  cmdline: git remote set-url -- origin https://github.com/beeware/briefcase-macOS-app-template.git https://github.com/beeware/briefcase-macOS-app-template.git
  stderr: 'fatal: No such URL found: https://github.com/beeware/briefcase-macOS-app-template.git'
```
I had actually encountered this recently myself in https://github.com/beeware/briefcase/issues/2077. It was related to what I thought would be uncommon configuration in `~/.gitconfig`.

For your issue, right now, you will need to adjust how `template` is being set. The `briefcase-template` is used to create new Briefcase projects; that is, it is used with the `briefcase new` command. Once you're trying to run `briefcase create`, you will need to use a platform-specific and format-output-specific template.

In this case, you're on macOS and the default output format is "app". Therefore, if you clone the template at https://github.com/beeware/briefcase-macos-app-template and specify its path in `pyproject.toml`, then you should be able to run `briefcase create`.

For instance:
```toml
[tool.briefcase.app.helloworld.macOS.app]
template = "/Users/en/briefcase-macos-app-template"
```



Patch:
diff --git a/changes/2077.bugfix.rst b/changes/2077.bugfix.rst
new file mode 100644
index 000000000..2991a96d0
--- /dev/null
+++ b/changes/2077.bugfix.rst
@@ -0,0 +1,1 @@
+Briefcase no longer fails to create projects or builds because it cannot update the Git configuration for the relevant template.
diff --git a/src/briefcase/commands/base.py b/src/briefcase/commands/base.py
index 418826f22..75fb393bb 100644
--- a/src/briefcase/commands/base.py
+++ b/src/briefcase/commands/base.py
@@ -1014,7 +1014,7 @@ def update_cookiecutter_cache(self, template: str, branch="master"):
                 # Ensure the existing repo's origin URL points to the location
                 # being requested. A difference can occur, for instance, if a
                 # fork of the template is used.
-                remote.set_url(new_url=template, old_url=remote.url)
+                remote.set_url(new_url=template)
                 try:
                     # Attempt to update the repository
                     remote.fetch()


Test patch:
diff --git a/tests/commands/base/test_update_cookiecutter_cache.py b/tests/commands/base/test_update_cookiecutter_cache.py
index 052f0f50a..82673e853 100644
--- a/tests/commands/base/test_update_cookiecutter_cache.py
+++ b/tests/commands/base/test_update_cookiecutter_cache.py
@@ -219,7 +219,6 @@ def test_existing_repo_template(base_command, mock_git):
     mock_repo.remote.assert_called_once_with(name="origin")
     mock_remote.set_url.assert_called_once_with(
         new_url="https://example.com/magic/special-template.git",
-        old_url="https://example.com/magic/special-template.git",
     )
     mock_remote.fetch.assert_called_once_with()
 
@@ -307,7 +306,6 @@ def test_existing_repo_template_with_different_url(base_command, mock_git):
     mock_repo.remote.assert_called_once_with(name="origin")
     mock_remote.set_url.assert_called_once_with(
         new_url="https://example.com/magic/special-template.git",
-        old_url="https://example.com/existing/special-template.git",
     )
     mock_remote.fetch.assert_called_once_with()
 
@@ -356,7 +354,6 @@ def test_offline_repo_template(base_command, mock_git, capsys):
     mock_repo.remote.assert_called_once_with(name="origin")
     mock_remote.set_url.assert_called_once_with(
         new_url="https://example.com/magic/special-template.git",
-        old_url="https://example.com/magic/special-template.git",
     )
     mock_remote.fetch.assert_called_once_with()
 
@@ -407,7 +404,6 @@ def test_cached_missing_branch_template(base_command, mock_git):
     mock_repo.remote.assert_called_once_with(name="origin")
     mock_remote.set_url.assert_called_once_with(
         new_url="https://example.com/magic/special-template.git",
-        old_url="https://example.com/magic/special-template.git",
     )
     mock_remote.fetch.assert_called_once_with()