Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
git_gitea [01/10/2022 - 10:26] – ↷ Seitename wurde von git auf git_gitea geändert thommie4 | git_gitea [25/04/2025 - 09:09] (aktuell) – [Remote Repos] thommie_netzwissen.de | ||
---|---|---|---|
Zeile 6: | Zeile 6: | ||
* [[https:// | * [[https:// | ||
- | ===== GIT ===== | + | ===== Basisfunktionen & lokale |
- | + | ||
- | ==== Basisfunktionen & Lokale | + | |
- Arbeitskopie = die echten Dateien, dynamisch | - Arbeitskopie = die echten Dateien, dynamisch | ||
- '' | - '' | ||
- | - HEAD zeigt immer auf letzten Commit. Ein '' | + | |
+ | | ||
Initialisierung: | Initialisierung: | ||
Zeile 19: | Zeile 18: | ||
git init | git init | ||
git add . | git add . | ||
+ | |||
</ | </ | ||
Zeile 25: | Zeile 25: | ||
'' | '' | ||
+ | Nachträgliches Ändern eines commit Textes | ||
- | ==== Remote Repos: Verknüpfen einer lokalen Instanz mit Github ==== | + | '' |
- | **Kontrolle der Remote Ziele " | ||
+ | ===== Remote Repos ===== | ||
+ | |||
+ | " | ||
+ | |||
+ | **Kontrolle der Remote Ziele " | ||
< | < | ||
git remote -v | git remote -v | ||
Zeile 37: | Zeile 42: | ||
upstream | upstream | ||
upstream | upstream | ||
+ | |||
</ | </ | ||
Zeile 42: | Zeile 48: | ||
* 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. | ||
+ | * upstream = Master repo, eigene commits landen dort per Pull Request | ||
- | Anders bei öffentlichen Repos: Öffentliche Repos werden zunächst geforkt, also eine Kopie im eigenen Repo-Speicher als " | + | Aus [[https://www.theserverside.com/ |
- | * upstream = öffentliches Github Repo (z.B. [[https:// | + | ===== Fix upstream |
- | Lokale Instanz: hinzufügen des entfernten | + | If you constantly run into Git's fatal "Current branch has no upstream branch" |
+ | < | ||
+ | This is done by setting the push.autoSetupRemote option in any of [[https:// | ||
+ | |||
+ | ===== How to set push.autoSetupRemote ===== | ||
+ | |||
+ | To tell Git to automatically create new branches in remote repositories upon a push, simply issue the following command: | ||
+ | < | ||
+ | |||
+ | With that configuration setting in place, you'll never have to push with the | ||
+ | < | ||
+ | |||
+ | |||
+ | ===== öffentliche Repos: Kollaboration ===== | ||
+ | |||
+ | Öffentliche Repos werden zunächst geforkt, also eine Kopie im eigenen Repo-Speicher als " | ||
+ | |||
+ | * upstream = öffentliches Github Repo (z.B. [[https:// | ||
+ | |||
+ | 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 58: | Zeile 86: | ||
< | < | ||
git remote add upstream '' | git remote add upstream '' | ||
+ | |||
</ | </ | ||
- | ==== Synchronisation lokales Repo mit entfernten ==== | + | ===== Authentifizierung über access token ===== |
+ | |||
+ | < | ||
+ | git remote set-url origin https:// | ||
+ | |||
+ | </ | ||
+ | |||
+ | ====== Synchronisation lokales Repo mit entfernten | ||
**pushen** | **pushen** | ||
Zeile 73: | Zeile 109: | ||
'' | '' | ||
- | |||
===== Github: entferntes Repo klonen ===== | ===== Github: entferntes Repo klonen ===== | ||
Zeile 83: | Zeile 118: | ||
'' | '' | ||
- | ====== Update des Fork auf Github | + | ===== Update des Fork auf Github ===== |
Das geht über das **lokale** | Das geht über das **lokale** | ||
Zeile 89: | Zeile 124: | ||
Updates von Upstream holen | Updates von Upstream holen | ||
- | < | + | < |
+ | '' | ||
</ | </ | ||
- | Zum master wechseln | + | Zum master |
- | < | + | < |
+ | '' | ||
</ | </ | ||
Zeile 101: | Zeile 138: | ||
Master mit upstream mergen | Master mit upstream mergen | ||
- | < | + | < |
+ | '' | ||
</ | </ | ||
Zeile 107: | Zeile 145: | ||
Danach push auf den fork setzen. | Danach push auf den fork setzen. | ||
- | ===== Branches ===== | + | ====== Branches ====== |
+ | |||
+ | Branch erzeugen | ||
+ | |||
+ | < | ||
+ | git checkout -b iss53 | ||
+ | </ | ||
Wo bin ich (aktueller Branch) | Wo bin ich (aktueller Branch) | ||
- | <file> | + | <code> |
- | git show branch | + | git branch |
- | </file> | + | </code> |
- | Alle Branches im Repo zeigen | + | Alle Branches im lokalen und im remote |
< | < | ||
Zeile 125: | Zeile 169: | ||
remotes/ | remotes/ | ||
remotes/ | remotes/ | ||
+ | </ | ||
+ | |||
+ | Nur die remotes zeigen | ||
+ | |||
+ | < | ||
+ | git branch -r | ||
</ | </ | ||
Zeile 151: | Zeile 201: | ||
'' | '' | ||
- | Download eines Branch | + | ===== Download eines bestimmten |
'' | '' | ||
- | danach | + | danach |
'' | '' | ||
+ | Oder: | ||
- | ====== update | + | '' |
+ | |||
+ | ===== Merge & update ===== | ||
'' | '' | ||
Zeile 168: | Zeile 221: | ||
'' | '' | ||
- | ==== Upstream nach fork mergen ==== | + | ===== Upstream nach fork mergen |
Lokales Ziel | Lokales Ziel | ||
- | |||
< | < | ||
+ | |||
git checkout //master// | git checkout //master// | ||
Zeile 186: | Zeile 239: | ||
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 211: | Zeile 264: | ||
git config -global core.editor [editor] | git config -global core.editor [editor] | ||
- | </ | + | </ |
|'' | |'' | ||
|'' | |'' | ||
Zeile 223: | Zeile 276: | ||
|'' | |'' | ||
|'' | |'' | ||
- | | | | | + | | |
- | ====== Atom ====== | + | ===== Repo duplizieren |
- | [[https:// | + | Create a bare clone of the repository. |
- | Globale Tastenkürzel | + | $ git clone –bare [[https:// |
- | ^Kürzel ^was machts ^Anmerkung | | + | Mirror-push to the new repository. |
- | |Ctrl-Shift-P |Kommando-Palette | | | + | |
- | |Ctrl-T oder Ctrl-P |Suche nach Dateiname im Projekt | | | + | |
- | |Ctrl-B |Suche nach Text in offenen Dateien im Projekt | | | + | |
- | |Ctrl-F |Suche nach Text in allen offenen Dateien | | | + | |
- | |Ctrl-Shift-F |Suche nach Text in alle Dateien im Projekt | | | + | |
- | ===== Atom Fenster ausserhalb des sichtbaren Bereiches ===== | + | $ cd old-repository.git $ git push –mirror [[https:// |
- | [[https:// | + | Remove the temporary local repository you created earlier. |
- | Workaround: | + | $ cd .. $ rm -rf old-repository.git |
- | '' | + | ===== Alte commits entfernen ===== |
- | oder | + | Commits sichten |
+ | < | ||
- | ALT+TAB–> | + | git log --oneline |
- | oder für Windows | + | </ |
- | * Select the Atom window | + | Neuen Branch erzeugen, aber ohne history |
- | * Open the context menu with Alt-Space. | + | |
- | * Select move using “m” | + | |
- | * Press any of the arrow keys. | + | |
- | * The Atom window will now be possible to drag back to the main monitor using the mouse. | + | |
- | ====== Markdown ====== | + | < |
+ | git checkout --orphan tem_branch | ||
- | https:// | + | </code> |
- | [[https:// | + | Alle Files hinzufügen |
- | ===== ASCIIDoc ===== | + | < |
+ | git add -A | ||
- | [[https:// | + | </code> |
- | ==== Admonition ==== | + | Inital commit im neuen Branch |
- | <nowrap> NOTE: An admonition paragraph draws the reader' | + | <code> |
+ | git commit -am " | ||
- | Here are the other built-in admonition types: | + | </ |
- | TIP: Pro tip… | + | Alten Branch löschen |
- | IMPORTANT: Don't forget… | + | < |
+ | git branch -D main | ||
- | WARNING: Watch out for… | + | </ |
- | CAUTION: Ensure that… </ | + | Den aktuellen Brach umbenennen |
- | ==== Formatierung ==== | + | < |
+ | git branch -m main | ||
+ | < | ||
- | < | + | Den " |
- | italic _constrained_ & __un__constrained | + | < |
+ | git push -f origin main | ||
- | bold italic *_constrained_* & **__un__** | + | </ |
- | monospace `constrained` & ``un``constrained | + | ====== Git mit SSH ====== |
- | monospace bold `*constrained*` & ``**un**``constrained | + | Mehrere ssh Key benutzen: |
- | monospace italic `_constrained_` & ``__un__``constrained | + | Keys zum agent hinzufügen: |
- | monospace | + | < |
+ | < | ||
- | Document header | + | </ |
- | < | + | .ssh/config |
- | My document provides… | + | < |
+ | < | ||
- | ==== Überschriften ==== | + | #HostName gitea.netzwissen.de |
+ | # IdentityFile ~/ | ||
+ | # User git | ||
- | '' | + | Host 192.168.72.12 |
+ | IdentityFile ~/ | ||
+ | User thommie | ||
- | ==== Listen ==== | + | Host kakariki.netzwissen.de |
+ | HostName kakariki.netzwissen.de | ||
+ | IdentityFile ~/ | ||
- | Unordered, basic[[https: | + | </code> |
- | < | + | Im Repo selbst |
- | * Edgar Allen Poe | + | |
- | * Sheri S. Tepper | + | |
- | * Bill Bryson | + | |
- | </ | + | |
- | Unordered, basic (alt)[[https:// | + | .git/config |
- | <file> | + | <code> |
- | - Edgar Allen Poe | + | <font inherit/ |
- | - Sheri S. Tepper | + | filemode = true |
- | - Bill Bryson | + | bare = false |
- | </file> | + | |
+ | ** | ||
+ | [remote " | ||
+ | url = ssh:// | ||
+ | fetch = +refs/ | ||
+ | [branch " | ||
+ | | ||
+ | merge = refs/ | ||
- | Nested Lists: To nest one list within another, indent each item in the sublist by four spaces. You can also nest other elements like paragraphs, blockquotes or code blocks. | + | </code> |
+ | ====== Gitea ====== | ||
- | ===== Gitea ===== | + | Git with a cup of tea - A painless self-hosted Git service |
- | Git with a cup of tea - A painless self-hosted Git service | + | [[https:// |
- | https:// | + | [[https://dl.gitea.io/gitea/ |
- | https://dl.gitea.io/gitea/xxx/gitea-xxx-linux-arm64 | + | [[https://docs.gitea.io/en-us/upgrade-from-gitea/|https:// |
- | + | ||
- | https:// | + | |
Upgrade script: / | Upgrade script: / | ||
- | |||