Git befehle: Unterschied zwischen den Versionen
Saya (Diskussion | Beiträge) Die Seite wurde neu angelegt: „✅ 1️⃣ Prüfen, ob sie evtl. ignoriert werden Erst checken, ob eine .gitignore die Dateien ausschließt: cat .gitignore Falls dort z. B. config/ oder *.yaml steht, würden sie nicht mit aufgenommen werden. ✅ 2️⃣ Dateien zum Repo hinzufügen Du bist aktuell hier: ~/docker/homepage Dann einfach: git add homepage/config/settings.yaml git add homepage/config/services.yaml Oder beide auf einmal: git add homepage/config/settings.yaml hom…“ |
Saya (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
||
| Zeile 1: | Zeile 1: | ||
= Git – Docker Services versionieren = | |||
== 1. Prüfen ob Dateien ignoriert werden == | |||
Überprüfen, ob eine `.gitignore` bestimmte Dateien ausschließt: | |||
<syntaxhighlight lang="bash"> | |||
cat .gitignore | cat .gitignore | ||
</syntaxhighlight> | |||
Typische problematische Einträge: | |||
<syntaxhighlight lang="bash"> | |||
config/ | |||
*.yaml | |||
*.yml | |||
</syntaxhighlight> | |||
Wenn solche Regeln existieren, werden die Dateien nicht versioniert. | |||
--- | |||
== 2. Bestimmte Dateien zum Repository hinzufügen == | |||
Beispiel (Homepage): | |||
Pfad: | |||
~/docker/homepage | ~/docker/homepage | ||
Gewünschte Dateien: | |||
- homepage/config/settings.yaml | |||
- homepage/config/services.yaml | |||
Einzeln hinzufügen: | |||
<syntaxhighlight lang="bash"> | |||
git add homepage/config/settings.yaml | git add homepage/config/settings.yaml | ||
git add homepage/config/services.yaml | git add homepage/config/services.yaml | ||
</syntaxhighlight> | |||
Oder gemeinsam: | |||
<syntaxhighlight lang="bash"> | |||
git add homepage/config/settings.yaml homepage/config/services.yaml | |||
</syntaxhighlight> | |||
--- | |||
== 3. Commit erstellen == | |||
<syntaxhighlight lang="bash"> | |||
git commit -m "Add homepage settings and services config" | git commit -m "Add homepage settings and services config" | ||
</syntaxhighlight> | |||
--- | |||
== 4. Änderungen zu Gitea pushen == | |||
<syntaxhighlight lang="bash"> | |||
git push | git push | ||
</syntaxhighlight> | |||
--- | |||
== 5. Kompletten Ordner hinzufügen == | |||
Alles im aktuellen Verzeichnis hinzufügen: | |||
<syntaxhighlight lang="bash"> | |||
git add . | |||
</syntaxhighlight> | |||
Vorher prüfen, was hinzugefügt wird: | |||
<syntaxhighlight lang="bash"> | |||
git status | |||
</syntaxhighlight> | |||
--- | |||
= Git Repository prüfen = | |||
== Welches Remote-Repository wird verwendet? == | |||
<syntaxhighlight lang="bash"> | |||
git remote -v | |||
</syntaxhighlight> | |||
Beispiel: | |||
<syntaxhighlight lang="bash"> | |||
origin http://192.168.2.10:3000/saya/homepage.git (fetch) | |||
origin http://192.168.2.10:3000/saya/homepage.git (push) | |||
</syntaxhighlight> | |||
Zeigt, wohin gepusht wird (z. B. Gitea). | |||
--- | |||
== Detailinformationen zum Remote == | |||
<syntaxhighlight lang="bash"> | |||
git remote show origin | |||
</syntaxhighlight> | |||
Zeigt: | |||
- Tracking-Branch | |||
- Default-Branch | |||
- Push-URL | |||
--- | |||
== Aktuellen Branch anzeigen == | |||
<syntaxhighlight lang="bash"> | |||
git branch | |||
</syntaxhighlight> | |||
Der aktive Branch hat ein `*`. | |||
Alternativ: | |||
<syntaxhighlight lang="bash"> | |||
git status | |||
</syntaxhighlight> | |||
--- | |||
== Gesamte Git-Konfiguration anzeigen == | |||
<syntaxhighlight lang="bash"> | |||
git config --list | |||
</syntaxhighlight> | |||
Nur Remote-URL anzeigen: | |||
<syntaxhighlight lang="bash"> | |||
git config --get remote.origin.url | |||
</syntaxhighlight> | |||
--- | |||
= Empfehlung für Docker-Services = | |||
Versionieren: | |||
- docker-compose.yml | |||
- *.yaml / *.yml Konfigurationsdateien | |||
- .env (ohne Passwörter) | |||
- Eigene Scripts | |||
Nicht versionieren: | |||
- Logs | |||
- Datenbanken | |||
- Cache | |||
- Laufzeitdaten aus Volumes | |||
- Media-Dateien | |||
Version vom 13. Februar 2026, 14:20 Uhr
Git – Docker Services versionieren
1. Prüfen ob Dateien ignoriert werden
Überprüfen, ob eine `.gitignore` bestimmte Dateien ausschließt:
cat .gitignore
Typische problematische Einträge:
config/
*.yaml
*.yml
Wenn solche Regeln existieren, werden die Dateien nicht versioniert.
---
2. Bestimmte Dateien zum Repository hinzufügen
Beispiel (Homepage):
Pfad: ~/docker/homepage
Gewünschte Dateien: - homepage/config/settings.yaml - homepage/config/services.yaml
Einzeln hinzufügen:
git add homepage/config/settings.yaml
git add homepage/config/services.yaml
Oder gemeinsam:
git add homepage/config/settings.yaml homepage/config/services.yaml
---
3. Commit erstellen
git commit -m "Add homepage settings and services config"
---
4. Änderungen zu Gitea pushen
git push
---
5. Kompletten Ordner hinzufügen
Alles im aktuellen Verzeichnis hinzufügen:
git add .
Vorher prüfen, was hinzugefügt wird:
git status
---
Git Repository prüfen
Welches Remote-Repository wird verwendet?
git remote -v
Beispiel:
origin http://192.168.2.10:3000/saya/homepage.git (fetch)
origin http://192.168.2.10:3000/saya/homepage.git (push)
Zeigt, wohin gepusht wird (z. B. Gitea).
---
Detailinformationen zum Remote
git remote show origin
Zeigt: - Tracking-Branch - Default-Branch - Push-URL
---
Aktuellen Branch anzeigen
git branch
Der aktive Branch hat ein `*`.
Alternativ:
git status
---
Gesamte Git-Konfiguration anzeigen
git config --list
Nur Remote-URL anzeigen:
git config --get remote.origin.url
---
Empfehlung für Docker-Services
Versionieren: - docker-compose.yml - *.yaml / *.yml Konfigurationsdateien - .env (ohne Passwörter) - Eigene Scripts
Nicht versionieren: - Logs - Datenbanken - Cache - Laufzeitdaten aus Volumes - Media-Dateien