Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
git_gitea [09/10/2023 - 07:45] – thommie4 | git_gitea [05/03/2024 - 10:52] (aktuell) – Externe Bearbeitung 127.0.0.1 | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
====== GIT und GITHUB Basisdoku ====== | ====== GIT und GITHUB Basisdoku ====== | ||
- | |||
* [[https:// | * [[https:// | ||
Zeile 7: | Zeile 6: | ||
* [[https:// | * [[https:// | ||
- | ====== Basisfunktionen & lokale Instanz | + | ===== Basisfunktionen & lokale Instanz ===== |
- Arbeitskopie = die echten Dateien, dynamisch | - Arbeitskopie = die echten Dateien, dynamisch | ||
- '' | - '' | ||
- | - '' | + | - '' |
- | - HEAD zeigt immer auf letzten Commit. Ein '' | + | - HEAD zeigt immer auf letzten Commit. Ein '' |
Initialisierung: | Initialisierung: | ||
- | |||
< | < | ||
+ | |||
git init | git init | ||
git add . | git add . | ||
+ | |||
</ | </ | ||
Zeile 25: | Zeile 25: | ||
'' | '' | ||
+ | ===== Remote Repos: Verknüpfen einer lokalen Instanz mit Remote Instanzen ===== | ||
- | ====== Remote Repos: Verknüpfen einer lokalen Instanz mit Remote Instanzen ====== | + | " |
- | + | ||
- | + | ||
- | " | + | |
**Kontrolle der Remote Ziele " | **Kontrolle der Remote Ziele " | ||
Zeile 40: | Zeile 38: | ||
upstream | upstream | ||
upstream | upstream | ||
+ | |||
</ | </ | ||
Zeile 46: | Zeile 45: | ||
* origin = persönliches git Repo auf Github. Die kann ein privater Fork eines öffentlichen Repos auf github sein. | * origin = persönliches git Repo auf Github. Die kann ein privater Fork eines öffentlichen Repos auf github sein. | ||
- | Anders bei öffentlichen Repos: Öffentliche Repos werden zunächst geforkt, also eine Kopie im eigenen Repo-Speicher als " | + | Anders bei öffentlichen Repos: Öffentliche Repos werden zunächst geforkt, also eine Kopie im eigenen Repo-Speicher als " |
- | * upstream = öffentliches Github Repo (z.B. [[https:// | + | * upstream = öffentliches Github Repo (z.B. [[https:// |
Lokale Instanz: hinzufügen des entfernten " | Lokale Instanz: hinzufügen des entfernten " | ||
- | |||
< | < | ||
- | git remote add origin git@github.com: | + | |
+ | git remote add origin git@github.com: | ||
git push -u origin master | git push -u origin master | ||
+ | |||
</ | </ | ||
Zeile 61: | Zeile 61: | ||
< | < | ||
git remote add upstream '' | git remote add upstream '' | ||
+ | |||
</ | </ | ||
===== Authentifizierung über access token ===== | ===== Authentifizierung über access token ===== | ||
- | |||
< | < | ||
git remote set-url origin https:// | git remote set-url origin https:// | ||
- | </ | ||
- | ===== Synchronisation lokales Repo mit entfernten ===== | + | </ |
+ | ====== Synchronisation lokales Repo mit entfernten ====== | ||
**pushen** | **pushen** | ||
Zeile 84: | Zeile 84: | ||
'' | '' | ||
- | |||
===== Github: entferntes Repo klonen ===== | ===== Github: entferntes Repo klonen ===== | ||
- | |||
Lokale Kopie des aktuellen Arbeitsstandes auf github anlegen | Lokale Kopie des aktuellen Arbeitsstandes auf github anlegen | ||
Zeile 101: | Zeile 99: | ||
Updates von Upstream holen | Updates von Upstream holen | ||
- | < | + | < |
+ | '' | ||
</ | </ | ||
Zeile 107: | Zeile 106: | ||
Zum master bzw. main wechseln | Zum master bzw. main wechseln | ||
- | < | + | < |
+ | '' | ||
</ | </ | ||
Zeile 113: | Zeile 113: | ||
Master mit upstream mergen | Master mit upstream mergen | ||
- | < | + | < |
+ | '' | ||
</ | </ | ||
Zeile 120: | Zeile 121: | ||
====== Branches ====== | ====== Branches ====== | ||
- | |||
Wo bin ich (aktueller Branch) | Wo bin ich (aktueller Branch) | ||
Zeile 126: | Zeile 126: | ||
< | < | ||
git branch | git branch | ||
+ | |||
</ | </ | ||
Zeile 138: | Zeile 139: | ||
remotes/ | remotes/ | ||
remotes/ | remotes/ | ||
+ | |||
</ | </ | ||
Zeile 144: | Zeile 146: | ||
< | < | ||
git checkout master | git checkout master | ||
+ | |||
</ | </ | ||
Zeile 165: | Zeile 168: | ||
===== Download eines bestimmten Branch ===== | ===== Download eines bestimmten Branch ===== | ||
- | |||
'' | '' | ||
- | danach | + | danach |
'' | '' | ||
Zeile 175: | Zeile 177: | ||
Oder: | Oder: | ||
- | '' | + | '' |
- | ====== Merge & update | + | ===== Merge & update ===== |
'' | '' | ||
Zeile 188: | Zeile 190: | ||
Lokales Ziel | Lokales Ziel | ||
- | |||
< | < | ||
+ | |||
git checkout //master// | git checkout //master// | ||
Zeile 203: | Zeile 205: | ||
Danach commit, review und push auf den fork bei Github | Danach commit, review und push auf den fork bei Github | ||
- | ===== Wenn etwas ganz schiefgeht ===== | + | ====== Wenn etwas ganz schiefgeht ====== |
'' | '' | ||
Zeile 221: | Zeile 222: | ||
====== Basis Konfiguration eines Repos ====== | ====== Basis Konfiguration eines Repos ====== | ||
- | |||
|< | |< | ||
Zeile 230: | Zeile 230: | ||
git config -global core.editor [editor] | git config -global core.editor [editor] | ||
- | </ | + | </ |
|'' | |'' | ||
|'' | |'' | ||
Zeile 242: | Zeile 242: | ||
|'' | |'' | ||
|'' | |'' | ||
- | | | | | + | | |
- | + | ||
- | ====== Repo duplizieren ====== | + | |
+ | ===== Repo duplizieren ===== | ||
Create a bare clone of the repository. | Create a bare clone of the repository. | ||
- | $ git clone --bare https:// | + | $ git clone –bare [[https:// |
Mirror-push to the new repository. | Mirror-push to the new repository. | ||
- | $ cd old-repository.git | + | $ cd old-repository.git $ git push –mirror |
- | $ git push --mirror https:// | + | |
Remove the temporary local repository you created earlier. | Remove the temporary local repository you created earlier. | ||
- | $ cd .. | + | $ cd .. $ rm -rf old-repository.git |
- | $ rm -rf old-repository.git | + | |
===== Alte commits entfernen ===== | ===== Alte commits entfernen ===== | ||
- | |||
Commits sichten | Commits sichten | ||
+ | < | ||
- | < | ||
git log --oneline | git log --oneline | ||
+ | |||
</ | </ | ||
- | Neuen Branch erzeugen, aber ohne history (--orphan) | + | Neuen Branch erzeugen, aber ohne history (–orphan) |
< | < | ||
git checkout --orphan tem_branch | git checkout --orphan tem_branch | ||
+ | |||
</ | </ | ||
Zeile 281: | Zeile 278: | ||
< | < | ||
git add -A | git add -A | ||
+ | |||
</ | </ | ||
Zeile 287: | Zeile 285: | ||
< | < | ||
git commit -am " | git commit -am " | ||
+ | |||
</ | </ | ||
Zeile 293: | Zeile 292: | ||
< | < | ||
git branch -D main | git branch -D main | ||
+ | |||
</ | </ | ||
Zeile 305: | Zeile 305: | ||
< | < | ||
git push -f origin main | git push -f origin main | ||
+ | |||
</ | </ | ||
- | ====== | + | ====== |
+ | Mehrere ssh Key benutzen: | ||
- | Git with a cup of tea - A painless self-hosted Git service | + | Keys zum agent hinzufügen: |
- | https://gitea.io/en-us/ | + | < |
+ | < | ||
- | https:// | + | </code> |
- | https:// | + | .ssh/config |
- | Upgrade script: | + | < |
+ | < | ||
+ | #HostName gitea.netzwissen.de | ||
+ | # IdentityFile ~/ | ||
+ | # User git | ||
+ | |||
+ | Host 192.168.72.12 | ||
+ | IdentityFile ~/ | ||
+ | User thommie | ||
+ | |||
+ | Host kakariki.netzwissen.de | ||
+ | HostName kakariki.netzwissen.de | ||
+ | IdentityFile ~/ | ||
+ | |||
+ | </ | ||
+ | |||
+ | Im Repo selbst | ||
+ | |||
+ | .git/config | ||
+ | |||
+ | < | ||
+ | < | ||
+ | | ||
+ | bare = false | ||
+ | | ||
+ | ** | ||
+ | [remote " | ||
+ | url = ssh:// | ||
+ | fetch = +refs/ | ||
+ | [branch " | ||
+ | | ||
+ | merge = refs/ | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | ====== Gitea ====== | ||
+ | |||
+ | Git with a cup of tea - A painless self-hosted Git service | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | Upgrade script: / | ||