From 5950eb66d6c84b4b7c9a0f5f5d6cce326c3ceef7 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Tue, 7 May 2019 11:35:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/welcome_controller.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index 9ce1905f..4feaa3d0 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -153,8 +153,12 @@ 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};git remote remove origin;git remote add origin #{new_giturl}; + # 如果有目录才执行 + if system("cd tmp/repositories/#{local_git_path}") + system("cd tmp/repositories/#{local_git_path};git remote remove origin;git remote add origin #{new_giturl}; git add .;git commit -m '..';git push origin master") + end + # http://Hjqreturn:xinhu1ji2qu3@bdgit.educoder.net/Hjqreturn/pgfqe6ch8.git (fetch)