docs: adiciona instrucoes para repositorio privado
Some checks failed
Some checks failed
Atualiza docs/SETUP.md e scripts/setup-dev.sh com: - Instrucoes para configurar chave SSH - Opcao de usar Personal Access Token (PAT) - Comandos para clonar/configurar via SSH ou HTTPS - Script setup-dev.sh agora aceita --ssh para repo privado 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
9e385b664d
commit
9c258b43f1
2 changed files with 131 additions and 11 deletions
|
|
@ -1,9 +1,18 @@
|
|||
#!/bin/bash
|
||||
# Script de setup para ambiente de desenvolvimento
|
||||
# Uso: ./scripts/setup-dev.sh
|
||||
# Uso: ./scripts/setup-dev.sh [--ssh]
|
||||
#
|
||||
# Opcoes:
|
||||
# --ssh Configurar remotes usando SSH (para repositorio privado)
|
||||
|
||||
set -e
|
||||
|
||||
# Verificar se deve usar SSH
|
||||
USE_SSH=false
|
||||
if [ "$1" = "--ssh" ]; then
|
||||
USE_SSH=true
|
||||
fi
|
||||
|
||||
echo "=== Setup do Ambiente de Desenvolvimento ==="
|
||||
echo ""
|
||||
|
||||
|
|
@ -11,12 +20,14 @@ echo ""
|
|||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
CYAN='\033[0;36m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Funcao para printar status
|
||||
ok() { echo -e "${GREEN}[OK]${NC} $1"; }
|
||||
warn() { echo -e "${YELLOW}[AVISO]${NC} $1"; }
|
||||
err() { echo -e "${RED}[ERRO]${NC} $1"; }
|
||||
info() { echo -e "${CYAN}[INFO]${NC} $1"; }
|
||||
|
||||
# 1. Verificar pre-requisitos
|
||||
echo "1. Verificando pre-requisitos..."
|
||||
|
|
@ -46,6 +57,31 @@ else
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# Verificar SSH key (se usando SSH)
|
||||
if [ "$USE_SSH" = true ]; then
|
||||
echo ""
|
||||
echo "1.1. Verificando chave SSH..."
|
||||
if [ -f "$HOME/.ssh/id_ed25519.pub" ] || [ -f "$HOME/.ssh/id_rsa.pub" ]; then
|
||||
ok "Chave SSH encontrada"
|
||||
echo " Certifique-se de que a chave esta adicionada no GitHub e Forgejo"
|
||||
else
|
||||
warn "Chave SSH nao encontrada!"
|
||||
echo ""
|
||||
echo " Para criar uma chave SSH:"
|
||||
echo " ssh-keygen -t ed25519 -C \"seu-email@exemplo.com\""
|
||||
echo ""
|
||||
echo " Depois adicione a chave publica em:"
|
||||
echo " - GitHub: Settings > SSH and GPG keys > New SSH key"
|
||||
echo " - Forgejo: Settings > SSH / GPG Keys > Add Key"
|
||||
echo ""
|
||||
read -p " Deseja continuar mesmo assim? (s/N) " -n 1 -r
|
||||
echo
|
||||
if [[ ! $REPLY =~ ^[Ss]$ ]]; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
# 2. Configurar remotes do Git
|
||||
|
|
@ -57,11 +93,39 @@ if [ ! -d ".git" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# URLs dos remotes
|
||||
if [ "$USE_SSH" = true ]; then
|
||||
ORIGIN_URL="git@github.com:esdrasrenan/sistema-de-chamados.git"
|
||||
FORGEJO_URL="ssh://git@git.esdrasrenan.com.br:2222/esdras/sistema-de-chamados.git"
|
||||
info "Usando SSH para os remotes (repositorio privado)"
|
||||
else
|
||||
ORIGIN_URL="https://github.com/esdrasrenan/sistema-de-chamados.git"
|
||||
FORGEJO_URL="https://git.esdrasrenan.com.br/esdras/sistema-de-chamados.git"
|
||||
info "Usando HTTPS para os remotes (repositorio publico)"
|
||||
fi
|
||||
|
||||
# Configurar/atualizar origin
|
||||
CURRENT_ORIGIN=$(git remote get-url origin 2>/dev/null || echo "")
|
||||
if [ "$CURRENT_ORIGIN" != "$ORIGIN_URL" ]; then
|
||||
if [ -n "$CURRENT_ORIGIN" ]; then
|
||||
git remote set-url origin "$ORIGIN_URL"
|
||||
ok "Remote 'origin' atualizado para $ORIGIN_URL"
|
||||
fi
|
||||
else
|
||||
ok "Remote 'origin' ja configurado corretamente"
|
||||
fi
|
||||
|
||||
# Verificar/adicionar remote forgejo
|
||||
if git remote get-url forgejo &> /dev/null; then
|
||||
ok "Remote 'forgejo' ja configurado"
|
||||
CURRENT_FORGEJO=$(git remote get-url forgejo)
|
||||
if [ "$CURRENT_FORGEJO" != "$FORGEJO_URL" ]; then
|
||||
git remote set-url forgejo "$FORGEJO_URL"
|
||||
ok "Remote 'forgejo' atualizado para $FORGEJO_URL"
|
||||
else
|
||||
ok "Remote 'forgejo' ja configurado corretamente"
|
||||
fi
|
||||
else
|
||||
git remote add forgejo https://git.esdrasrenan.com.br/esdras/sistema-de-chamados.git
|
||||
git remote add forgejo "$FORGEJO_URL"
|
||||
ok "Remote 'forgejo' adicionado"
|
||||
fi
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue