-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit-git.sh
More file actions
executable file
·96 lines (80 loc) · 3.47 KB
/
init-git.sh
File metadata and controls
executable file
·96 lines (80 loc) · 3.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/usr/bin/env bash
# ============================================================================
# Script: Inicializar repositório Git profissional
# ============================================================================
set -euo pipefail
readonly PROJECT_DIR="/home/recifecrypto/Documentos/Projetos C#/Blazor-AppWeb"
readonly REMOTE_URL="${1:-https://github.com/RafaelBatistaDev/Blazor-AppWeb.git}"
readonly BRANCH="main"
# Cores
G="\033[1;32m" B="\033[1;34m" Y="\033[1;33m" R="\033[1;31m" N="\033[0m"
log() { echo -e "${B}[INFO]${N} $*"; }
success() { echo -e "${G}[OK]${N} $*"; }
warn() { echo -e "${Y}[WARN]${N} $*"; }
error() { echo -e "${R}[ERR]${N} $*"; exit 1; }
# ============================================================================
cd "$PROJECT_DIR" || error "Diretório não encontrado: $PROJECT_DIR"
log "🔧 Inicializando repositório Git profissional..."
# Remover .git antigo se existir
if [[ -d .git ]]; then
warn "Repositório Git existente será removido"
rm -rf .git
fi
# Inicializar novo repositório
log "→ Criando novo repositório..."
git init -b "$BRANCH"
success "Repositório inicializado na branch '$BRANCH'"
# Configurar usuário (se não estiver configurado globalmente)
if ! git config user.email >/dev/null 2>&1; then
log "→ Configurando git user..."
git config user.name "Rafael Batista" || warn "Falha ao configurar user.name"
git config user.email "seu-email@example.com" || warn "Falha ao configurar user.email"
success "Usuário Git configurado"
fi
# Adicionar remote
log "→ Adicionando remote origem..."
git remote add origin "$REMOTE_URL"
success "Remote configurado: $REMOTE_URL"
# Staged all files
log "→ Preparando arquivos para commit..."
git add .
git status --short
# Primeiro commit
log "→ Criando primeiro commit..."
git commit -m "feat: repositório Blazor-AppWeb profissional
- Estrutura completa com layouts e páginas
- Documentação: README, CONTRIBUTING, DEVELOPMENT
- CI/CD GitHub Actions
- .gitignore e .editorconfig
- Licença MIT
- Pronto para produção"
success "Primeiro commit realizado"
log ""
log "═══════════════════════════════════════════════════════════════════════"
log "✅ Repositório Git inicializado com sucesso!"
log "═══════════════════════════════════════════════════════════════════════"
log ""
log "📋 Próximas ações:"
log ""
log "1️⃣ Se o repositório ainda não existe no GitHub, crie em:"
log " ${B}https://github.com/new${N}"
log ""
log "2️⃣ Configure credenciais (se necessário):"
log " ${B}git config --global credential.helper store${N}"
log " ${B}git push origin main${N} (será solicitada senha/token)"
log ""
log "3️⃣ Fazer push inicial:"
log " ${B}cd '$PROJECT_DIR'${N}"
log " ${B}git push -u origin main${N}"
log ""
log "4️⃣ Verificar no GitHub:"
log " ${B}https://github.com/RafaelBatistaDev/Blazor-AppWeb${N}"
log ""
log "═══════════════════════════════════════════════════════════════════════"
log ""
log "📊 Status do repositório:"
git status
log ""
log "🔗 Remote configurado:"
git remote -v
log ""