167 lines
3.7 KiB
Markdown
167 lines
3.7 KiB
Markdown
# 🚀 Subir proyecto local a Gitea (Mac + Tailscale)
|
|
|
|
> Guía ordenada por **flujo normal de trabajo**. Si algo falla, sigue las marcas ⚠️ que apuntan a su resolución al final del documento.
|
|
|
|
---
|
|
|
|
## PARTE A — FLUJO NORMAL (paso a paso)
|
|
|
|
### 1. Crear repositorio en Gitea
|
|
- Nombre: `descarga_adjuntos_correos_cpe`
|
|
- Sin README
|
|
- Sin opciones automáticas
|
|
|
|
> Guarda la URL del repositorio para usarla después.
|
|
|
|
### 2. Crear `.gitignore`
|
|
```bash
|
|
cd /Users/george/descarga_adjuntos_correos_cpe
|
|
touch .gitignore
|
|
```
|
|
|
|
### 3. Editar `.gitignore`
|
|
```bash
|
|
nano .gitignore
|
|
```
|
|
|
|
#### Contenido recomendado
|
|
```bash
|
|
__pycache__/
|
|
*.pyc
|
|
.env
|
|
venv/
|
|
.DS_Store
|
|
secrets.yaml
|
|
.vscode/
|
|
.idea/
|
|
```
|
|
|
|
> ⚠️ ¿Ya habías hecho `git add` antes de crear el `.gitignore`? → [[#Resolución: archivos que debían ignorarse siguen apareciendo]]
|
|
|
|
### 4. Inicializar repositorio Git
|
|
```bash
|
|
cd /Users/george/descarga_adjuntos_correos_cpe
|
|
git init
|
|
```
|
|
|
|
### 5. Agregar archivos
|
|
```bash
|
|
git add .
|
|
```
|
|
|
|
> ⚠️ ¿Agregaste errores o archivos incorrectos? → [[#Resolución: quitar archivos del staging (deshacer git add)]]
|
|
|
|
### 6. Primer commit
|
|
```bash
|
|
git commit -m "primer commit"
|
|
```
|
|
|
|
> ⚠️ ¿El commit quedó mal y aún no hice push? → [[#Resolución: deshacer un commit antes de subirlo]]
|
|
|
|
### 7. Conectar repo local con Gitea
|
|
```bash
|
|
git remote add origin http://100.68.242.27:30000/george/descarga_adjuntos_correos_cpe.git
|
|
```
|
|
|
|
> ⚠️ ¿El remote ya existe o está mal configurado? → [[#Resolución: problemas con el remote]]
|
|
|
|
### 8. Subir código por primera vez
|
|
```bash
|
|
git branch -M main
|
|
git push -u origin main
|
|
```
|
|
|
|
> ⚠️ ¿El push falla por conexión o autenticación? → [[#Resolución: no puedo subir (push)]]
|
|
|
|
---
|
|
|
|
## PARTE B — VARIANTES DE COMMIT
|
|
|
|
Estos pasos van **después** del commit básico según lo que necesites.
|
|
|
|
### Commit de un proyecto dentro de una Solución
|
|
```bash
|
|
git add ProyectoA/
|
|
git status
|
|
git commit -m "mensaje commit para los archivos modificados del proyecto"
|
|
```
|
|
|
|
### Commit de un archivo específico dentro de un proyecto
|
|
```bash
|
|
git add ProyectoA/FacturaNegociable.cs
|
|
git status
|
|
git commit -m "mensaje commit para el archivo especifico del proyecto"
|
|
```
|
|
|
|
---
|
|
|
|
## PARTE C — FLUJO DIARIO
|
|
|
|
```bash
|
|
git add .
|
|
git commit -m "mensaje claro"
|
|
git push
|
|
```
|
|
|
|
---
|
|
|
|
## PARTE D — CLONAR / REUTILIZAR
|
|
|
|
### Clonar repositorio
|
|
```bash
|
|
git clone http://100.68.242.27:3000/george/descarga_adjuntos_correos_cpe.git
|
|
```
|
|
|
|
### Validar conexión con Gitea
|
|
```bash
|
|
curl http://100.68.242.27:30000
|
|
```
|
|
|
|
---
|
|
|
|
## PARTE E — ACCESO
|
|
|
|
- [URL de Gitea en NAS](http://100.68.242.27:30000)
|
|
|
|
---
|
|
|
|
# 🔧 RESOLUCIÓN DE PROBLEMAS
|
|
|
|
## Resolución: archivos que debían ignorarse siguen apareciendo
|
|
Si ya hiciste `git add` antes del `.gitignore`, quitalos del índice:
|
|
```bash
|
|
git rm -r --cached .
|
|
git add .
|
|
git commit -m "aplicar gitignore correctamente"
|
|
```
|
|
|
|
## Resolución: quitar archivos del staging (deshacer git add)
|
|
Si agregaste archivos que no deberían ir, reversa el `git add` **antes** de commitear:
|
|
```bash
|
|
git reset
|
|
```
|
|
|
|
## Resolución: deshacer un commit antes de subirlo
|
|
Si ya hiciste commit pero **aún no** hiciste push:
|
|
```bash
|
|
git reset --soft HEAD~1
|
|
git reset
|
|
```
|
|
|
|
## Resolución: no puedo subir (push)
|
|
- Verifica la conexión con el NAS: `curl http://100.68.242.27:30000`
|
|
- Revisa si el remote está bien configurado: `git remote -v`
|
|
|
|
## Resolución: problemas con el remote (URL incorrecta o antigua)
|
|
### Cambiar la URL del repositorio
|
|
```bash
|
|
git remote set-url origin http://100.x.x.x:3000/george/descarga_adjuntos_correos_cpe.git
|
|
git remote -v
|
|
```
|
|
|
|
### Eliminar y volver a configurar el remote
|
|
```bash
|
|
git remote remove origin
|
|
git remote add origin http://100.68.242.27:3000/george/descarga_adjuntos_correos_cpe.git
|
|
```
|