From 621bad86dd231f5f562328a07c81276fb56defe5 Mon Sep 17 00:00:00 2001 From: Kaiser-Yang <624626089@qq.com> Date: Fri, 25 Oct 2024 10:56:26 +0800 Subject: [PATCH] Fix a bug: can not push to a public repo This solved #82. --- script/deploy_helper.py | 3 +++ src/main/java/edu/cmipt/gcs/util/GitoliteUtil.java | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/script/deploy_helper.py b/script/deploy_helper.py index 217cf63..c97bca3 100644 --- a/script/deploy_helper.py +++ b/script/deploy_helper.py @@ -462,6 +462,9 @@ def install_redis(): def deploy_on_ubuntu(config): assert(config != None) + if os.path.exists(application_config_file_path): + res = os.system(f'rm -rf {application_config_file_path}') + command_checker(res, f"Failed to remove {application_config_file_path}") if config.serviceType != 'systemd': essential_packages.remove('systemd') apt_install_package(parse_iterable_into_str(essential_packages)) diff --git a/src/main/java/edu/cmipt/gcs/util/GitoliteUtil.java b/src/main/java/edu/cmipt/gcs/util/GitoliteUtil.java index bb39ef4..4ee379f 100644 --- a/src/main/java/edu/cmipt/gcs/util/GitoliteUtil.java +++ b/src/main/java/edu/cmipt/gcs/util/GitoliteUtil.java @@ -30,8 +30,10 @@ public static synchronized boolean initUserConfig(Long userId) { @%d_ssh_key = repo @%d_private_repo RW+ = @%d_ssh_key + repo @%d_public_repo + RW+ = @%d_ssh_key """ - .formatted(userId, userId, userId, userId, userId); + .formatted(userId, userId, userId, userId, userId, userId, userId); Files.writeString(userConfPath, content); List lines = Files.readAllLines(Paths.get(GitConstant.GITOLITE_CONF_FILE_PATH)); for (int i = 0; i < lines.size(); i++) {