Files
dzentra_bot/docs/git_flow_dzentra_bot.md

190 lines
2.3 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Git Setup Flow: dzentra_bot
## Полный процесс: от `git init` до первого `push` в Gitea
---
## 📍 0. Перейти в корень проекта
```bash
cd ~/vsprojects/dzentra_bot
pwd
```
Ожидаемо:
```
.../vsprojects/dzentra_bot
```
---
## 🧱 1. Инициализация Git
```bash
git init
```
Проверка:
```bash
git status
```
---
## 📦 2. Проверка `.gitignore`
```bash
cat .gitignore
```
Должны быть строки:
```
app/.env
app/.venv/
__pycache__/
.DS_Store
```
---
## 3. Добавить все файлы
```bash
git add .
```
Проверка:
```bash
git status
```
---
## 💾 4. Первый commit
```bash
git commit -m "bootstrap v2 stable start"
```
---
## 🔗 5. Подключить удалённый репозиторий (Gitea)
```bash
git remote add origin https://gitadmin@git.segeba.by/gitadmin/dzentra_bot.git
```
Проверка:
```bash
git remote -v
```
---
## 🌿 6. Установить ветку main
```bash
git branch -M main
```
---
## 🔐 7. Настроить сохранение токена (macOS)
```bash
git config --global credential.helper osxkeychain
```
---
## 🚀 8. Первый push
```bash
git push -u origin main
```
При запросе:
### Username:
```
gitadmin
```
### Password:
👉 вставить **Personal Access Token из Gitea**
---
## ✅ 9. Проверка
```bash
git status
git branch -vv
```
Проверить в Gitea — файлы должны появиться.
---
# 🔁 Дальнейшая работа
## Каждый цикл разработки
```bash
git status
git add .
git commit -m "описание изменения"
git push
```
---
# 🖥 Работа с проектом
## Запуск бота
```bash
cd app
source .venv/bin/activate
python -m src.main
```
## Git всегда из корня
```bash
cd ~/vsprojects/dzentra_bot
git status
```
---
# 🚀 Deploy на Synology
```bash
git pull
sudo docker compose -f infra/compose/docker-compose.yml up --build -d
```
---
# ⚠️ Важно
Не коммитить:
```
app/.env
app/.venv
ключи
пароли
логи
```
---
# 🎯 Итог
Git используется как:
- система контроля версий
- история проекта
- мост между Mac и Synology