From 593ee71e79f76235d209631fe10ed86e22e061e5 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Tue, 7 May 2019 10:55:18 +0800 Subject: [PATCH] .. --- app/controllers/welcome_controller.rb | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index e727d92b..44d4fb12 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -150,12 +150,15 @@ class WelcomeController < ApplicationController shixun.update_column(:git_url, g.project(shixun.gpid).path_with_namespace) local_git_path = local_shixun.local_giturl.split('/').last if local_shixun.local_giturl.present? new_giturl = "http://educoder:xinhu1ji2qu3@"+g.project(shixun.gpid).http_url_to_repo.split('//').last - system("cd tmp/repositories/#{local_git_path}") - system("git remote remove origin") - system("git remote add origin #{new_giturl}") - system("git add .") - system("git commit -m '..'") - system("git push origin master") + if system("cd tmp/repositories/#{local_git_path};") + system("git remote remove origin") + system("git remote add origin #{new_giturl}") + system("git add .") + system("git commit -m '..'") + system("git push origin master") + end + + # http://Hjqreturn:xinhu1ji2qu3@bdgit.educoder.net/Hjqreturn/pgfqe6ch8.git (fetch) # 同步关卡信息 local_challenges = LocalChallenge.where(local_shixun_id: local_shixun.id)