Bladeren bron

fix: enhance installation directory check and update remote origin URL to HTTPS

Manuel 6 maanden geleden
bovenliggende
commit
7b716474d9
1 gewijzigde bestanden met toevoegingen van 11 en 1 verwijderingen
  1. 11 1
      install.sh

+ 11 - 1
install.sh

@@ -207,7 +207,7 @@ findInstallDir() {
     fi
 
     for dir in $destinos; do
-        if [ -d "$dir" ]; then
+        if [ -f "$dir/app.py" ] && [ -f "$dir/requirements.txt" ]; then
             log_msg "INFO" "Directorio de instalación encontrado: $dir"
             echo "$dir"
             return 0
@@ -260,6 +260,16 @@ updateOrCloneRepo() {
             cp .env /tmp/.env.backup
         fi
 
+        remote_url=$(git remote get-url origin 2>/dev/null || true)
+        if [ -n "$remote_url" ] && echo "$remote_url" | grep -qE '^(git@|ssh://)github.com[:/]'; then
+            log_msg "INFO" "Remote origin usa SSH ($remote_url), cambiando a HTTPS"
+            git remote set-url origin "$repo_url" >> "$LOG_FILE" 2>&1 || {
+                error "No se pudo actualizar la URL remota a HTTPS"
+                return 1
+            }
+            log_msg "INFO" "Remote origin actualizado a $repo_url"
+        fi
+
         if git fetch origin "$branch" && git checkout "$branch" && git pull origin "$branch"; then
             [ "$env_exists" = true ] && mv /tmp/.env.backup .env
             log_msg "OK" "Repositorio actualizado exitosamente en la rama '$branch'"