corregimos bug con directorios no iniciados
This commit is contained in:
@ -54,22 +54,6 @@ else
|
|||||||
echo "⚠️ Credenciales guardadas sin cifrar."
|
echo "⚠️ Credenciales guardadas sin cifrar."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 📍 Verificar si estamos en un repositorio Git
|
|
||||||
if ! git rev-parse --is-inside-work-tree &> /dev/null; then
|
|
||||||
echo "📁 Este directorio no es un repositorio Git."
|
|
||||||
read -p "¿Querés inicializarlo ahora? (s/n): " init_repo
|
|
||||||
if [[ "$init_repo" == "s" ]]; then
|
|
||||||
git init
|
|
||||||
read -p "📦 Ingresá el nombre del repositorio remoto (ej: git-operaciones.git): " repo_nombre
|
|
||||||
remote_url="$GITEA_API_URL/$GITEA_USER/$repo_nombre"
|
|
||||||
git remote add origin "$remote_url"
|
|
||||||
echo "✅ Repositorio inicializado y remoto configurado: $remote_url"
|
|
||||||
else
|
|
||||||
echo "🚫 Instalación cancelada. Ejecutá desde un repositorio Git válido."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 📜 Script principal
|
# 📜 Script principal
|
||||||
cat <<'EOF' > "$HOME/.scripts/git-subir.sh"
|
cat <<'EOF' > "$HOME/.scripts/git-subir.sh"
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
@ -89,6 +73,22 @@ else
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# 📍 Verificar si estamos en un repositorio Git
|
||||||
|
if ! git rev-parse --is-inside-work-tree &> /dev/null; then
|
||||||
|
echo "📁 Este directorio no es un repositorio Git."
|
||||||
|
read -p "¿Querés inicializarlo ahora? (s/n): " init_repo
|
||||||
|
if [[ "$init_repo" == "s" ]]; then
|
||||||
|
git init
|
||||||
|
read -p "📦 Ingresá el nombre del repositorio remoto (ej: git-operaciones.git): " repo_nombre
|
||||||
|
remote_url="$GITEA_API_URL/$GITEA_USER/$repo_nombre"
|
||||||
|
git remote add origin "$remote_url"
|
||||||
|
echo "✅ Repositorio inicializado y remoto configurado: $remote_url"
|
||||||
|
else
|
||||||
|
echo "🚫 Operación cancelada. Ejecutá desde un repositorio Git válido."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
remote_url=$(git remote get-url origin | sed 's|https://||')
|
remote_url=$(git remote get-url origin | sed 's|https://||')
|
||||||
auth_url="https://$GITEA_USER:$GITEA_TOKEN@$remote_url"
|
auth_url="https://$GITEA_USER:$GITEA_TOKEN@$remote_url"
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user