git_gitea

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
git_gitea [30/06/2023 - 18:23] thommie4git_gitea [25/04/2025 - 09:09] (aktuell) – [Remote Repos] thommie_netzwissen.de
Zeile 6: Zeile 6:
   * [[https://www.thomas-krenn.com/de/wiki/Git_Grundbefehle|https://www.thomas-krenn.com/de/wiki/Git_Grundbefehle]]   * [[https://www.thomas-krenn.com/de/wiki/Git_Grundbefehle|https://www.thomas-krenn.com/de/wiki/Git_Grundbefehle]]
  
-===== GIT ===== +===== Basisfunktionen & lokale Instanz =====
- +
-==== Basisfunktionen & lokale Instanz ====+
  
   - Arbeitskopie = die echten Dateien, dynamisch   - Arbeitskopie = die echten Dateien, dynamisch
   - ''git add''  addiert den aktuellen Datenstand in den Index ("Stage")   - ''git add''  addiert den aktuellen Datenstand in den Index ("Stage")
-  - HEAD zeigt immer auf letzten Commit. Ein ''git commit -m "Commit-Nachricht"''  übernimmt den Status nach HEAD. +  - ''git coomit''  trägt den Datenstand in den HEAD ein (standardmässig in den "main" Branch) 
 +  - HEAD zeigt immer auf letzten Commit. Ein ''git commit -m "Commit-Nachricht"''  übernimmt den Status nach HEAD.
  
 Initialisierung: leeres Repository erzeugen und die darin vorhandenen Dateien in den lokalen git Index aufnehmen Initialisierung: leeres Repository erzeugen und die darin vorhandenen Dateien in den lokalen git Index aufnehmen
Zeile 19: Zeile 18:
 git init git init
 git add . git add .
 +
 </code> </code>
  
Zeile 25: Zeile 25:
 ''git commit -m "Commit-Nachricht"'' ''git commit -m "Commit-Nachricht"''
  
 +Nachträgliches Ändern eines commit Textes
  
-==== Remote Repos: Verknüpfen einer lokalen Instanz mit Github ====+''git commit –amend -m "xxxxx"''
  
-**Kontrolle der Remote Ziele "origin" und "upstream"** 
  
 +===== Remote Repos =====
 +
 +"origin" ist das **eigene** Standard-remote-Repo (z.B. github, gitea). "upstream" ist das Team-Repo. Änderungen aus "origin" werden mit einem Pull Request für das "upstream" Repo angeboten. Von dort wird die Änderungen per "pull" geholt, falls sie akzeptiert wird.
 +
 +**Kontrolle der Remote Ziele "origin" und "upstream"**
 <code> <code>
 git remote -v git remote -v
Zeile 37: Zeile 42:
 upstream        git@github.com:owncloud/docs.git (fetch) upstream        git@github.com:owncloud/docs.git (fetch)
 upstream        git@github.com:owncloud/docs.git (push) upstream        git@github.com:owncloud/docs.git (push)
 +
 </code> </code>
  
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 "origin" angelegtLokale Änderungen werden zuerst nach origin übertragenDanach werden sie per pull request (PR) zur Übernahme nach  upstream "angemeldet".+Aus [[https://www.theserverside.com/video/How-to-use-Gits-set-upstream-push-command|https://www.theserverside.com/video/How-to-use-Gits-set-upstream-push-command]] :
  
-  * upstream = öffentliches Github Repo (z.B. [[https://github.com/owncloud/core|https://github.com/owncloud/core]]). +===== Fix upstream branch errors with autoSetupRemote =====
  
-Lokale Instanz: hinzufügen des entfernten "origin"+If you constantly run into Git's fatal "Current branch has no upstream brancherror, and you find issuing the 
 + <font inherit/ ;;inherit;;inherit>git push --set-upstream</font>  command constantly to be annoying, you can tell Git to use the set-upstream option automatically whenever you push a new branch to the server.
  
 +This is done by setting the push.autoSetupRemote option in any of [[https://www.theserverside.com/blog/Coffee-Talk-Java-News-Stories-and-Opinions/Use-Git-config-list-to-inspect-gitconfig-variable-settings|Git's configuration files]].
 +
 +===== How to set push.autoSetupRemote =====
 +
 +To tell Git to automatically create new branches in remote repositories upon a push, simply issue the following command:
 + <font inherit/ ;;inherit;;inherit>git config --global --add --bool **push.autoSetupRemote** true</font>
 +
 +With that configuration setting in place, you'll never have to push with the
 + <font inherit/ ;;inherit;;inherit>git push --set-upstream</font>  command ever again.
 +
 +
 +===== öffentliche Repos: Kollaboration =====
 +
 +Öffentliche Repos werden zunächst geforkt, also eine Kopie im eigenen Repo-Speicher als "origin" angelegt. Lokale Änderungen werden zuerst nach origin übertragen. Danach werden sie per pull request (PR) zur Übernahme nach upstream "angemeldet".
 +
 +  * upstream = öffentliches Github Repo (z.B. [[https://github.com/owncloud/core|https://github.com/owncloud/core]]).
 +
 +Lokale Instanz: hinzufügen des entfernten "origin"
 <code> <code>
-git remote add origin git@github.com:thommierother/oc-theme-nw2.git + 
 +git remote add origin git@github.com:thommierother/oc-theme-nw2.git
 git push -u origin master git push -u origin master
 +
 </code> </code>
  
Zeile 58: Zeile 86:
 <code> <code>
 git remote add upstream ''git@github.com:https://github.com/owncloud/docs.git'' git remote add upstream ''git@github.com:https://github.com/owncloud/docs.git''
 +
 </code> </code>
  
-==== Authentifizierung über access token ====+===== Authentifizierung über access token =====
  
 <code> <code>
 git remote set-url origin https://username:token@github.com/username/repository.git git remote set-url origin https://username:token@github.com/username/repository.git
 +
 </code> </code>
  
-==== Synchronisation lokales Repo mit entfernten ====+====== Synchronisation lokales Repo mit entfernten ======
  
 **pushen** **pushen**
Zeile 79: Zeile 109:
  
 ''git fetch upstream ''Änderungen von upstream abholen ''git fetch upstream ''Änderungen von upstream abholen
- 
  
 ===== Github: entferntes Repo klonen ===== ===== Github: entferntes Repo klonen =====
Zeile 89: Zeile 118:
 ''git commit -m "Commit-Nachricht''  Änderungen hochladen ''git commit -m "Commit-Nachricht''  Änderungen hochladen
  
-====== Update des Fork auf Github ======+===== Update des Fork auf Github =====
  
 Das geht über das **lokale**  Repo: Das geht über das **lokale**  Repo:
Zeile 95: Zeile 124:
 Updates von Upstream holen Updates von Upstream holen
  
-<code>''$ git fetch upstream''+<code> 
 +''$ git fetch upstream''
  
 </code> </code>
Zeile 101: Zeile 131:
 Zum master bzw. main wechseln Zum master bzw. main wechseln
  
-<code>''git checkout master''+<code> 
 +''git checkout master''
  
 </code> </code>
Zeile 107: Zeile 138:
 Master mit upstream mergen Master mit upstream mergen
  
-<code>''git merge upstream/master''+<code> 
 +''git merge upstream/master''
  
 </code> </code>
Zeile 113: Zeile 145:
 Danach push auf den fork setzen. Danach push auf den fork setzen.
  
-===== Branches =====+====== Branches =====
 + 
 +Branch erzeugen 
 + 
 +<code> 
 +git checkout -b iss53 
 +</code>
  
 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 Repo zeigen (remotes)
  
 <code> <code>
Zeile 131: Zeile 169:
   remotes/origin/main   remotes/origin/main
   remotes/origin/master   remotes/origin/master
 +</code>
 +
 +Nur die remotes zeigen
 +
 +<code>
 +git branch -r
 </code> </code>
  
Zeile 157: Zeile 201:
 ''git branch -d feature_x'' ''git branch -d feature_x''
  
-Download eines Branch (vmware-host-modules)+===== Download eines bestimmten Branch =====
  
 ''git checkout -b workstation-16.2.1 origin/workstation-16.2.1'' ''git checkout -b workstation-16.2.1 origin/workstation-16.2.1''
  
-danach +danach
  
 ''git pull'' ''git pull''
  
 +Oder:
  
-=====update & merge ======+''git clone -b workstation-17.0.2 [[https://github.com/mkubecek/vmware-host-modules.git|https://github.com/mkubecek/vmware-host-modules.git]]'' 
 + 
 +===== Merge & update =====
  
 ''git pull'' ''git pull''
Zeile 174: Zeile 221:
 ''git diff <quell_branch> <ziel_branch>'' ''git diff <quell_branch> <ziel_branch>''
  
-==== Upstream nach fork mergen ====+===== Upstream nach fork mergen =====
  
 Lokales Ziel Lokales Ziel
- 
 <code> <code>
 +
 git checkout //master// git checkout //master//
  
Zeile 192: 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 ======
  
 ''git checkout – '' ''git checkout – ''
Zeile 217: Zeile 264:
 git config -global core.editor [editor] git config -global core.editor [editor]
  
-</file>      |**GIT User Konfiguration setzen**   |+</file>       |**GIT User Konfiguration setzen**   |
 |''git config -l ''   |**Konfiguration zeigen**   | |''git config -l ''   |**Konfiguration zeigen**   |
 |''git status ''   |**zeigt,ob eine Datei editiert wurde**   | |''git status ''   |**zeigt,ob eine Datei editiert wurde**   |
Zeile 229: Zeile 276:
 |''git log ''   |**Letzte Commits zeigen**   | |''git log ''   |**Letzte Commits zeigen**   |
 |''git fetch <remote>''   |**Objektstruktur runterladen**   | |''git fetch <remote>''   |**Objektstruktur runterladen**   |
-  |+    |
  
-====== Repo duplizieren ======+===== Repo duplizieren =====
  
 Create a bare clone of the repository. Create a bare clone of the repository.
  
-$ git clone --bare https://github.com/exampleuser/old-repository.git+$ git clone bare [[https://github.com/exampleuser/old-repository.git|https://github.com/exampleuser/old-repository.git]]
  
 Mirror-push to the new repository. Mirror-push to the new repository.
  
-$ cd old-repository.git +$ cd old-repository.git $ git push mirror [[https://github.com/exampleuser/new-repository.git|https://github.com/exampleuser/new-repository.git]]
-$ git push --mirror https://github.com/exampleuser/new-repository.git+
  
 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+
  
-====== Markdown ======+===== Alte commits entfernen =====
  
-https://www.markdownguide.org/basic-syntax/ +Commits sichten 
 +<code>
  
-[[https://guides.github.com/features/mastering-markdown/|https://guides.github.com/features/mastering-markdown/]]+git log --oneline
  
-===== ASCIIDoc =====+</code>
  
-[[https://asciidoctor.org/docs/asciidoc-syntax-quick-reference/|https://asciidoctor.org/docs/asciidoc-syntax-quick-reference/]]+Neuen Branch erzeugen, aber ohne history (–orphan)
  
-==== Admonition ====+<code> 
 +git checkout --orphan tem_branch
  
-<nowrapNOTE: An admonition paragraph draws the reader's attention to auxiliary information. Its purpose is determined by the label at the beginning of the paragraph.+</code>
  
-Here are the other built-in admonition types:+Alle Files hinzufügen
  
-TIP: Pro tip…+<code> 
 +git add -A
  
-IMPORTANT: Don't forget…+</code>
  
-WARNING: Watch out for…+Inital commit im neuen Branch
  
-CAUTION: Ensure that… </nowrap>+<code> 
 +git commit -am "Initial commit message"
  
-==== Formatierung ====+</code>
  
-<nowrap> old *constrained* & **un**constrained+Alten Branch löschen
  
-italic _constrained_ & __un__constrained+<code> 
 +git branch -D main
  
-bold italic *_constrained_* & **__un__**  constrained+</code>
  
-monospace `constrained` & ``un``constrained+Den aktuellen Brach umbenennen
  
-monospace bold `*constrained*` & ``**un**``constrained+<code> 
 +git branch -m main 
 +<code>
  
-monospace italic `_constrained_` & ``__un__``constrained+Den "zurückgesetzten" main Branch aufs remote laden
  
-monospace bold italic `*_constrained_*` & ``**__un__**``constrained </nowrap>+<code> 
 +git push -f origin main
  
-Document header+</code>
  
-<nowrap> My Document's Title Doc Writer <doc.writer@asciidoctor.org> v1.0, 2018-04-11 :toc: :imagesdir: assets/images :homepage: [[https://asciidoctor.org|https://asciidoctor.org]]+====== Git mit SSH ======
  
-My document provides… </nowrap>+Mehrere ssh Key benutzen:
  
-==== Überschriften ====+Keys zum agent hinzufügen:
  
-''= Document Title (Level 0) == Level 1 Section Title === Level 2 Section Title ==== Level 3 Section Title ===== Level 4 Section Title ====== Level 5 Section Title == Another Level 1 Section Title ''+<code> 
 + <font inherit/monospace;;inherit;;#000000background-color:#ffffff;>ssh-add ~/.ssh/id_rsa3</font>
  
-==== Listen ====+</code>
  
-Unordered, basic[[https://asciidoctor.org/docs/asciidoc-syntax-quick-reference/#|view result]]+.ssh/config
  
-<file+<code
-* Edgar Allen Poe + <font inherit/monospace;;inherit;;#000000background-color:#ffffff;>Host gitea gitea.netzwissen.de</font      ForwardAgent yes
-* Sheri STepper +
-* Bill Bryson +
-</file>+
  
-Unordered, basic (alt)[[https://asciidoctor.org/docs/asciidoc-syntax-quick-reference/#|view result]]+#HostName gitea.netzwissen.de 
 +# IdentityFile ~/.ssh/id_rsa_gitea 
 +User git
  
-<file> +Host 192.168.72.12 
-- Edgar Allen Poe +IdentityFile ~/.ssh/id_rsa 
-- Sheri STepper +User thommie
-- Bill Bryson +
-</file>+
  
-Nested Lists: To nest one list within another, indent each item in the sublist by four spacesYou can also nest other elements like paragraphs, blockquotes or code blocks.+Host kakariki.netzwissen.de 
 +HostName kakariki.netzwissen.de 
 +IdentityFile ~/.ssh/id_rsa3
  
 +</code>
  
-===== Gitea =====+Im Repo selbst
  
-Git with a cup of tea - A painless self-hosted Git service +.git/config
  
-https://gitea.io/en-us/+<code> 
 + <font inherit/monospace;;inherit;;#000000background-color:#ffffff;>[core]</font>            repositoryformatversion = 0 
 +       filemode = true 
 +       bare = false 
 +       logallrefupdates = true 
 +**       sshCommand = ssh -i ~/.ssh/id_rsa** 
 +[remote "origin"
 +       url = ssh://git@gitea.netzwissen.de:2022/thommie/thommievault.git 
 +       fetch = +refs/heads/*:refs/remotes/origin/
 +[branch "main"
 +       remote = origin 
 +       merge = refs/heads/main
  
-https://dl.gitea.io/gitea/xxx/gitea-xxx-linux-arm64+</code>
  
-https://docs.gitea.io/en-us/upgrade-from-gitea/+====== Gitea ======
  
-Upgrade script: /etc/scripts/gitea_upgrade.sh+Git with a cup of tea - A painless self-hosted Git service
  
 +[[https://gitea.io/en-us/|https://gitea.io/en-us/]]
 +
 +[[https://dl.gitea.io/gitea/xxx/gitea-xxx-linux-arm64|https://dl.gitea.io/gitea/xxx/gitea-xxx-linux-arm64]]
 +
 +[[https://docs.gitea.io/en-us/upgrade-from-gitea/|https://docs.gitea.io/en-us/upgrade-from-gitea/]]
 +
 +Upgrade script: /etc/scripts/gitea_upgrade.sh
  
  
  • git_gitea.1688149438.txt.gz
  • Zuletzt geändert: 17/08/2024 - 07:06
  • (Externe Bearbeitung)