From 9ae6fa0438d0f5cfb5e75aab16bdda2aff8f7baa Mon Sep 17 00:00:00 2001 From: Tom Silver Date: Fri, 30 May 2025 10:25:23 -0400 Subject: [PATCH 1/2] attempt to fix apply configuration --- apply_configuration.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/apply_configuration.py b/apply_configuration.py index ddd54b7..c5dbd40 100644 --- a/apply_configuration.py +++ b/apply_configuration.py @@ -77,12 +77,16 @@ def _main() -> None: # Delete the existing git files if they are from the starter repo. git_repo = outer_dir / ".git" + using_ssh = True if git_repo.exists(): git_config_file = git_repo / "config" with open(git_config_file, "r", encoding="utf-8") as fp: git_config_contents = fp.read() if "git@github.com:tomsilver/python-starter.git" in git_config_contents: shutil.rmtree(git_repo) + elif "https://github.com/tomsilver/python-starter.git" in git_config_contents: + using_ssh = False + shutil.rmtree(git_repo) # Initialize the repo anew. subprocess.run(["git", "init"], check=True, capture_output=True) @@ -102,13 +106,17 @@ def _main() -> None: # Remote doesn't exist, so add the URL. else: remote_command = "add" + if using_ssh: + github_url = f"git@github.com:{github_username}/{repo_name}.git" + else: + github_url = f"https://github.com/{github_username}/{repo_name}.git" subprocess.run( [ "git", "remote", remote_command, "origin", - f"git@github.com:{github_username}/{repo_name}.git", + github_url, ], check=True, capture_output=True, From 08bcd5f7d5472983c52c2fc454301fb4945832dd Mon Sep 17 00:00:00 2001 From: Tom Silver Date: Fri, 30 May 2025 10:32:22 -0400 Subject: [PATCH 2/2] wip --- apply_configuration.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/apply_configuration.py b/apply_configuration.py index c5dbd40..f38e09e 100644 --- a/apply_configuration.py +++ b/apply_configuration.py @@ -77,7 +77,6 @@ def _main() -> None: # Delete the existing git files if they are from the starter repo. git_repo = outer_dir / ".git" - using_ssh = True if git_repo.exists(): git_config_file = git_repo / "config" with open(git_config_file, "r", encoding="utf-8") as fp: @@ -85,7 +84,6 @@ def _main() -> None: if "git@github.com:tomsilver/python-starter.git" in git_config_contents: shutil.rmtree(git_repo) elif "https://github.com/tomsilver/python-starter.git" in git_config_contents: - using_ssh = False shutil.rmtree(git_repo) # Initialize the repo anew. @@ -106,10 +104,7 @@ def _main() -> None: # Remote doesn't exist, so add the URL. else: remote_command = "add" - if using_ssh: - github_url = f"git@github.com:{github_username}/{repo_name}.git" - else: - github_url = f"https://github.com/{github_username}/{repo_name}.git" + github_url = f"git@github.com:{github_username}/{repo_name}.git" subprocess.run( [ "git",