This commit is contained in:
41
07_git/docs/git-installation.md
Normal file
41
07_git/docs/git-installation.md
Normal file
@@ -0,0 +1,41 @@
|
||||
# Einrichtung von Git
|
||||
|
||||
## Installation von gitscm (Git Bash)
|
||||
|
||||
[Git SCM](https://git-scm.com/)
|
||||
|
||||
Nachdem Git erfolgreich installiert wurde, muss es konfiguriert werden, bevor du es nutzen kannst. Dazu gehört die Einrichtung deines Benutzernamens und deiner E-Mail-Adresse, die bei jedem Commit verwendet werden, um zu kennzeichnen, wer die Änderungen vorgenommen hat.
|
||||
|
||||
### Benutzernamen konfigurieren
|
||||
Gib im Terminal oder in der Eingabeaufforderung den folgenden Befehl ein, ersetze dabei Your Name durch deinen Namen:
|
||||
|
||||
```bash
|
||||
git config --global user.name "Your Name"
|
||||
```
|
||||
Konfiguration des global verwendeten Git Nutzernamens mithilfe des Terminals
|
||||
|
||||
### E-Mail-Adresse konfigurieren
|
||||
Gib den folgenden Befehl ein, um deine E-Mail-Adresse festzulegen, ersetze dabei your.email@example.com durch deine E-Mail-Adresse:
|
||||
|
||||
```bash
|
||||
git config --global user.email "your.email@example.com"
|
||||
```
|
||||
Konfiguration der global verwendeten Git E-Mail-Adresse mithilfe des Terminals
|
||||
|
||||
### Konfiguration überprüfen
|
||||
|
||||
Überprüfe, ob die Konfiguration korrekt eingerichtet wurde:
|
||||
|
||||
```bash
|
||||
git config --global --list
|
||||
````
|
||||
|
||||
```bash
|
||||
user.name=Your Name
|
||||
user.email=your.email@example.com
|
||||
```
|
||||
|
||||
Ausgabe der Git-Konfiguration mithilfe des Terminals.
|
||||
|
||||
Diese Ausgabe zeigt dir die aktuellen Einstellungen für deinen Git-Benutzernamen und deine E-Mail-Adresse an.
|
||||
Um den git Modus zu verlassen verwende `:q`
|
||||
BIN
07_git/docs/git-installation.pdf
Normal file
BIN
07_git/docs/git-installation.pdf
Normal file
Binary file not shown.
171
07_git/docs/git-project.md
Normal file
171
07_git/docs/git-project.md
Normal file
@@ -0,0 +1,171 @@
|
||||
# Git Projektanweisung
|
||||
|
||||
1. **Projektordner vorbereiten & Git initialisieren:**
|
||||
Erstelle das Verzeichnis, wechsle hinein, initialisiere das Repository direkt mit dem Standard-Branch `main` und stelle sicher, dass kein alter `master`-Branch existiert.
|
||||
|
||||
```bash
|
||||
mkdir project-git
|
||||
cd project-git
|
||||
git init -b main
|
||||
|
||||
# Prüfung/Bereinigung falls 'master' noch existieren sollte:
|
||||
git branch -d master 2>/dev/null || true
|
||||
|
||||
```
|
||||
|
||||
|
||||
2. **README.md erstellen & committen:**
|
||||
Erstelle die Datei mit der geforderten Überschrift und führe den initialen Commit auf `main` durch.
|
||||
|
||||
```bash
|
||||
echo "# Implementierung eines Workflows" > README.md
|
||||
git add README.md
|
||||
git commit -m "docs: add initial README.md"
|
||||
|
||||
```
|
||||
|
||||
|
||||
3. **Feature-Branches anlegen:**
|
||||
Erstelle die beiden Branches `feature-1` und `feature-2` ausgehend vom aktuellen Stand auf `main`.
|
||||
|
||||
```bash
|
||||
git branch feature-1
|
||||
git branch feature-2
|
||||
|
||||
```
|
||||
|
||||
|
||||
4. **Arbeiten auf feature-1 (2 Commits):**
|
||||
Wechsle zu `feature-1`, erstelle `feature1.txt` und führe zwei getrennte Commits durch.
|
||||
|
||||
```bash
|
||||
git checkout feature-1
|
||||
|
||||
# Commit 1
|
||||
echo "Feature 1: Basis-Funktionalitaet" > feature1.txt
|
||||
git add feature1.txt
|
||||
git commit -m "feat: add feature1.txt with base logic"
|
||||
|
||||
# Commit 2
|
||||
echo "Feature 1: Erweiterung" >> feature1.txt
|
||||
git add feature1.txt
|
||||
git commit -m "feat: extend feature1.txt functionality"
|
||||
|
||||
```
|
||||
|
||||
|
||||
5. **Arbeiten auf feature-2 (2 Commits):**
|
||||
Wechsle zu `feature-2`, erstelle `feature2.txt` und führe ebenfalls zwei Commits durch.
|
||||
|
||||
```bash
|
||||
git checkout feature-2
|
||||
|
||||
# Commit 1
|
||||
echo "Feature 2: Erste Implementierung" > feature2.txt
|
||||
git add feature2.txt
|
||||
git commit -m "feat: add feature2.txt with base logic"
|
||||
|
||||
# Commit 2
|
||||
echo "Feature 2: Erweiterte Logik" >> feature2.txt
|
||||
git add feature2.txt
|
||||
git commit -m "feat: extend feature2.txt functionality"
|
||||
|
||||
```
|
||||
|
||||
|
||||
6. **feature-1 mergen & Tag v1.1.0 setzen:**
|
||||
Wechsle zurück auf `main`, führe den Merge für `feature-1` durch und tagge den ersten stabilen Zustand.
|
||||
|
||||
```bash
|
||||
git checkout main
|
||||
git merge feature-1 --no-edit
|
||||
git tag v1.1.0
|
||||
|
||||
```
|
||||
|
||||
|
||||
7. **feature-2 mergen & Tag v1.2.0 setzen:**
|
||||
Merge `feature-2` in den `main`-Branch und setze den nächsten Versions-Tag.
|
||||
|
||||
```bash
|
||||
git merge feature-2 --no-edit
|
||||
git tag v1.2.0
|
||||
|
||||
```
|
||||
|
||||
|
||||
8. **Gestagte und ungestagte Änderungen in feature-1 vornehmen:**
|
||||
Wechsle zurück zu `feature-1`. Erzeuge eine gestagte sowie eine ungestagte Änderung und speichere den Status-Dump.
|
||||
|
||||
```bash
|
||||
git checkout feature-1
|
||||
|
||||
# Gestagte Aenderung:
|
||||
echo "Aenderung 1 (gestaged)" >> feature1.txt
|
||||
git add feature1.txt
|
||||
|
||||
# Ungestagte Aenderung:
|
||||
echo "Aenderung 2 (ungestaged)" >> feature1.txt
|
||||
|
||||
# Status in Datei schreiben:
|
||||
git status > status.dump
|
||||
|
||||
```
|
||||
|
||||
|
||||
9. **Änderungen stashen:**
|
||||
Sichere alle Änderungen inklusive ungetrackter Dateien (`status.dump`) im Stash mit der geforderten Beschreibung.
|
||||
|
||||
```bash
|
||||
git stash push -u -m "Stash 1: Hotfix needed"
|
||||
|
||||
```
|
||||
|
||||
|
||||
10. **Hotfix-Branch erstellen, fixen & mergen:**
|
||||
Zweige vom Tag `v1.2.0` ab, erstelle `stash.dump`, committe diesen Fix und merge alles in `main`.
|
||||
|
||||
```bash
|
||||
# Hotfix-Branch von v1.2.0 erstellen:
|
||||
git checkout -b hotfix v1.2.0
|
||||
|
||||
# Stash-Liste exportieren und committen:
|
||||
git stash list > stash.dump
|
||||
git add stash.dump
|
||||
git commit -m "fix: resolve critical issue via stash inspection"
|
||||
|
||||
# In main mergen:
|
||||
git checkout main
|
||||
git merge hotfix --no-edit
|
||||
|
||||
```
|
||||
|
||||
|
||||
11. **feature-1 fortsetzen, abschließen & v1.2.1 taggen:**
|
||||
Kehre zu `feature-1` zurück, hole die Änderungen aus dem Stash, committe sie, merge den Branch in `main` und setze das finale Tag.
|
||||
|
||||
```bash
|
||||
git checkout feature-1
|
||||
git stash pop
|
||||
|
||||
# Alle wiederhergestellten Aenderungen committen:
|
||||
git add .
|
||||
git commit -m "feat: complete pending work on feature1"
|
||||
|
||||
# In main mergen und taggen:
|
||||
git checkout main
|
||||
git merge feature-1 --no-edit
|
||||
git tag v1.2.1
|
||||
|
||||
```
|
||||
|
||||
|
||||
---
|
||||
|
||||
Zur finalen Überprüfung der Tags und des Graphen:
|
||||
|
||||
```bash
|
||||
git tag
|
||||
git log --oneline --graph --all
|
||||
|
||||
```
|
||||
69
07_git/docs/git-ssh-installation-mac-os.md
Normal file
69
07_git/docs/git-ssh-installation-mac-os.md
Normal file
@@ -0,0 +1,69 @@
|
||||
# Installation MacOS
|
||||
|
||||
1. **Neuen SSH-Key für GitHub generieren:** Separaten Key anlegen, damit Gitea unberührt bleibt.
|
||||
Erstelle einen Key mit eigenem Dateinamen (z. B. `id_ed25519_github`):
|
||||
|
||||
```zsh
|
||||
ssh-keygen -t ed25519 -C "deine_email@example.com" -f ~/.ssh/id_ed25519_github
|
||||
|
||||
```
|
||||
|
||||
|
||||
2. **Key zum SSH-Agent / Keychain hinzufügen:** Schlüssel im macOS Schlüsselbund registrieren.
|
||||
```zsh
|
||||
ssh-add --apple-use-keychain ~/.ssh/id_ed25519_github
|
||||
|
||||
```
|
||||
|
||||
*(Unter Linux einfach `ssh-add ~/.ssh/id_ed25519_github` verwenden).*
|
||||
|
||||
|
||||
3. **SSH-Config anpassen (~/.ssh/config):** Verknüpft Hosts mit den jeweiligen Keys.
|
||||
Öffne deine SSH-Config:
|
||||
|
||||
```zsh
|
||||
code ~/.ssh/config
|
||||
|
||||
```
|
||||
|
||||
Stelle sicher, dass beide Hosts sauber getrennt eingetragen sind:
|
||||
|
||||
```text
|
||||
# Neuer GitHub-Key
|
||||
Host github.com
|
||||
HostName github.com
|
||||
User git
|
||||
AddKeysToAgent yes
|
||||
UseKeychain yes
|
||||
IdentityFile ~/.ssh/id_ed25519_github
|
||||
|
||||
```
|
||||
|
||||
Speichere mit **Ctrl + O**, **Enter** und schließe mit **Ctrl + X**.
|
||||
|
||||
|
||||
4. **Neuen Public Key auf GitHub hinterlegen:**
|
||||
Kopiere den Public Key in die Zwischenablage:
|
||||
|
||||
```zsh
|
||||
pbcopy < ~/.ssh/id_ed25519_github.pub
|
||||
|
||||
```
|
||||
|
||||
Füge ihn auf **github.com** unter **Settings** → **SSH and GPG keys** → **New SSH Key** ein.
|
||||
|
||||
|
||||
5. **Verbindung testen & Repository klonen:**
|
||||
Teste die Authentifizierung:
|
||||
|
||||
```zsh
|
||||
ssh -T git@github.com
|
||||
|
||||
```
|
||||
|
||||
Sobald `Hi <Username>! You've successfully authenticated...` erscheint, klone das Repo erneut z.B.:
|
||||
|
||||
```zsh
|
||||
git clone git@github.com:[REPO].git
|
||||
|
||||
```
|
||||
BIN
07_git/docs/git-ssh-installation-mac-os.pdf
Normal file
BIN
07_git/docs/git-ssh-installation-mac-os.pdf
Normal file
Binary file not shown.
96
07_git/docs/git-ssh-installation-windows.md
Normal file
96
07_git/docs/git-ssh-installation-windows.md
Normal file
@@ -0,0 +1,96 @@
|
||||
# Installation Windows
|
||||
|
||||
Auf Windows entfallen die macOS-spezifischen Direktiven (`UseKeychain` und `AddKeysToAgent`), da die Verwaltung systemweit vom Windows **OpenSSH-Agent-Dienst** übernommen wird.
|
||||
|
||||
---
|
||||
|
||||
### Schritt-für-Schritt-Anleitung für Windows (PowerShell)
|
||||
|
||||
1. **OpenSSH-Dienst prüfen (einmalig als Admin):** Stellt sicher, dass Windows Keys dauerhaft im Speicher hält.
|
||||
Falls noch nicht erledigt, öffne die **PowerShell als Administrator**:
|
||||
|
||||
```powershell
|
||||
Set-Service -Name ssh-agent -StartupType Automatic
|
||||
Start-Service ssh-agent
|
||||
|
||||
```
|
||||
|
||||
|
||||
2. **Neuen SSH-Key für GitHub generieren:** Separaten Key anlegen, damit Gitea unberührt bleibt.
|
||||
Führe in der normalen PowerShell aus:
|
||||
|
||||
```powershell
|
||||
ssh-keygen -t ed25519 -C "deine_email@example.com" -f $HOME\.ssh\id_ed25519_github
|
||||
```
|
||||
|
||||
* Vergib bei Bedarf eine Passphrase.
|
||||
|
||||
|
||||
3. **Key zum SSH-Agent hinzufügen:** Registriert den Schlüssel im Windows-Agenten.
|
||||
Gib deine Passphrase ein letztes Mal ein:
|
||||
|
||||
```powershell
|
||||
ssh-add $HOME\.ssh\id_ed25519_github
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
4. **SSH-Config anpassen (~/.ssh/config):** Trennung von GitHub und Gitea ohne macOS-spezifische Optionen.
|
||||
Öffne oder erstelle die Datei in VSCode:
|
||||
|
||||
```powershell
|
||||
code $HOME\.ssh\config
|
||||
|
||||
```
|
||||
|
||||
Füge die Konfiguration für beide Hosts ein:
|
||||
|
||||
```text
|
||||
# GitHub
|
||||
Host github.com
|
||||
HostName github.com
|
||||
User git
|
||||
IdentityFile ~/.ssh/id_ed25519_github
|
||||
IdentitiesOnly yes
|
||||
|
||||
```
|
||||
|
||||
Speichere die Datei mit **Strg + S** und schließe VSCode.
|
||||
|
||||
|
||||
5. **Public Key in die Windows-Zwischenablage kopieren:**
|
||||
```powershell
|
||||
Get-Content $HOME\.ssh\id_ed25519_github.pub | Set-Clipboard
|
||||
|
||||
```
|
||||
|
||||
Füge den Schlüssel auf **github.com** unter **Settings** → **SSH and GPG keys** → **New SSH Key** ein.
|
||||
|
||||
|
||||
6. **Verbindung testen & Repository klonen:**
|
||||
Prüfe die Verbindung:
|
||||
|
||||
```powershell
|
||||
ssh -T git@github.com
|
||||
|
||||
```
|
||||
|
||||
Klone das Repository z.B.:
|
||||
|
||||
```powershell
|
||||
git clone git@github.com:[REPO].git
|
||||
|
||||
```
|
||||
|
||||
|
||||
---
|
||||
|
||||
### Wichtiger Hinweis für Git Bash auf Windows
|
||||
|
||||
Damit auch die **Git Bash** dieselbe `~/.ssh/config` und den laufenden Windows-Dienst verwendet, stelle sicher, dass Git den Windows-nativen SSH-Client anspricht:
|
||||
|
||||
```bash
|
||||
git config --global core.sshCommand "ssh.exe"
|
||||
|
||||
```
|
||||
BIN
07_git/docs/git-ssh-installation-windows.pdf
Normal file
BIN
07_git/docs/git-ssh-installation-windows.pdf
Normal file
Binary file not shown.
1
07_git/project-git
Submodule
1
07_git/project-git
Submodule
Submodule 07_git/project-git added at bb1fa88efd
@@ -25,7 +25,7 @@
|
||||
"eslint": "^10.9.1",
|
||||
"eslint-plugin-react-hooks": "^7.1.1",
|
||||
"eslint-plugin-react-refresh": "^0.5.5",
|
||||
"globals": "^17.11.0",
|
||||
"globals": "^17.12.0",
|
||||
"sass": "^1.103.1",
|
||||
"vite": "^8.2.2"
|
||||
}
|
||||
@@ -1998,9 +1998,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/globals": {
|
||||
"version": "17.11.0",
|
||||
"resolved": "https://registry.npmjs.org/globals/-/globals-17.11.0.tgz",
|
||||
"integrity": "sha512-Z2I8hM+PbJDXQDq3Icgpzv+mPdwr68iZUU9d5WW4FuXfDUQfkZaZuvjMv42/5crNyw154+9+VWXbYrUgDXbxNw==",
|
||||
"version": "17.12.0",
|
||||
"resolved": "https://registry.npmjs.org/globals/-/globals-17.12.0.tgz",
|
||||
"integrity": "sha512-cezEd/DTyyht9cvSSURyygXPfy04GtWO/5e6ZPvH7fCtjKz9PYOmuawphw1Ctd1f6C+5JypXfGD7ahNMXvevBA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
"eslint": "^10.9.1",
|
||||
"eslint-plugin-react-hooks": "^7.1.1",
|
||||
"eslint-plugin-react-refresh": "^0.5.5",
|
||||
"globals": "^17.11.0",
|
||||
"globals": "^17.12.0",
|
||||
"sass": "^1.103.1",
|
||||
"vite": "^8.2.2"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user