Benutzer-Werkzeuge

Webseiten-Werkzeuge


git

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen RevisionVorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
git [2022-07-10 18:20:35] – [GPG konfigurieren] davidgit [2024-06-03 12:12:13] (aktuell) manfred
Zeile 1: Zeile 1:
 ====== Git ====== ====== Git ======
 +
 +Hilfe:
 +  > git --help
 +  > git status
 +  > git pull
 +  > git add *
 +  > git push
 +  > git commit -m "Kommentar"
  
 Git repository klonen (SSH & HTTPS): Git repository klonen (SSH & HTTPS):
Zeile 9: Zeile 17:
   > git config --system init.defaultBranch main   > git config --system init.defaultBranch main
  
-Es gibt 3 Konfigurationsmöglichkeiten: +Es gibt 3 Konfigurationsmöglichkeiten: ''%%--system%%''''%%--global%%'' und ''%%--local%%'' (siehe [[#pfade]]) 
-  * ''--system'' schreibt in die Datei ''/etc/gitconfig'' +
-  * ''--global'' schreibt in die Datei ''~/.gitconfig'' +
-  * ''--local'' schreibt direkt in das **aktuelle repo**+
  
 ===== Git Konfiguration ===== ===== Git Konfiguration =====
 +
 +
 +==== Pfade ====
 +
 +  * **Wichtig**: 
 +  * mehr Informationen: ''git config --help'' oder [[https://git-scm.com/docs/git-config#FILES]]
 +  * Einstellungen nachvollziehen: ''git config --list --show-origin'' (zeigt zu jedem Eintrag den Speicherort an)
 +
 +^ Scope    ^ Allgemein                ^ Linux (Beispiel)                   ^ Windows (Beispiel)                 ^
 +| System   | ''$(prefix)/etc/gitconfig''  | /usr/local/etc/gitconfig           | C:/Program Files/Git/etc/gitconfig |
 +| Global   | ''$HOME/.gitconfig''         | /home/user/.gitconfig              | C:/Users/user/.gitconfig           |
 +| Local    | ''$GIT_DIR/config''          | my-repo/.git/config                | my-repo/.git/config                |
 +| Worktree | ''$GIT_DIR/config.worktree'' | my-repo/.git/config.worktree       | my-repo/.git/config.worktree       |
 +
 +  * System: unter linux gibt diese beiden verbreiteten pfade: ''/usr/local/etc/gitconfig'' und ''/etc/gitconfig''
 +  * Global: ''$XDG_CONFIG_HOME/git/config'' und ''$HOME/.config/git/config'' werden auch unterstützt, aber von ''$HOME/.gitconfig'' überschrieben
 +  * Local: standard, wenn man keine option angibt (z.B. ''%%git config init.defaultBranch main%%'')
 +  * Worktree: sehr selten genutzt, siehe docs
  
  
Zeile 185: Zeile 209:
 ==== Linux ==== ==== Linux ====
  
-<code c ~/.gitconfig>+<code ini .gitconfig>
 [include] [include]
  path = .gitconfig.d/.gitalias  path = .gitconfig.d/.gitalias
Zeile 194: Zeile 218:
  autocrlf = false  autocrlf = false
  safecrlf = false  safecrlf = false
- symlinks = true+ fsmonitor = true
  fscache = true  fscache = true
 + symlinks = false
  preloadindex = true  preloadindex = true
  editor = code --wait  editor = code --wait
- attributesfile = ~/.gitattributes+ attributesfile = .gitattributes
 [init] [init]
  defaultBranch = main  defaultBranch = main
 [commit] [commit]
  gpgsign = true  gpgsign = true
 +[fetch]
 + prune = true
 [pull] [pull]
  rebase = true  rebase = true
-[credential+[push
- helper manager-core + autoSetupRemote true
-[format] +
- pretty = oneline+
 [log] [log]
  abbrevCommit = true  abbrevCommit = true
 +[format]
 + pretty = oneline
 +[credential]
 + helper = manager-core
 + gitHubAuthModes = pat
 + gitLabAuthModes = pat
 [http] [http]
  sslbackend = openssl  sslbackend = openssl
 [gpg] [gpg]
  program = gpg  program = gpg
-[diff] 
- tool = vscode 
 [diff "astextplain"] [diff "astextplain"]
  textconv = astextplain  textconv = astextplain
 [difftool] [difftool]
  prompt = true  prompt = true
 +[mergetool]
 + prompt = true
 +[diff]
 + tool = vscode
 +[merge]
 + tool = vscode
 [difftool "vscode"] [difftool "vscode"]
  cmd = code --wait --diff $LOCAL $REMOTE  cmd = code --wait --diff $LOCAL $REMOTE
  keepBackup = false  keepBackup = false
-[merge] 
- tool = vscode 
-[mergetool] 
- prompt = true 
 [mergetool "vscode"] [mergetool "vscode"]
  cmd = code --wait $MERGED  cmd = code --wait $MERGED
Zeile 235: Zeile 266:
 </code> </code>
  
-<code .gitconfig.d/.gitalias>+<code ini .gitconfig.d/.gitalias>
 [alias] [alias]
  a = add  a = add
Zeile 256: Zeile 287:
 </code> </code>
  
-<code .gitconfig.d/.gituser>+<code ini .gitconfig.d/.gituser>
 [user] [user]
     name = Username     name = Username
Zeile 266: Zeile 297:
 ==== Windows ==== ==== Windows ====
  
-folgende Änderungen an der Linux Konfiguration vornehmen (**sslbackend** ist optionalda **openssl** auch unter win funktioniert):+**Achtung**: keine vollständige Konfigurationnur Änderungen gegenüber der Datei für Linux!
  
-<code>+Folgende Änderungen an der Linux Konfiguration vornehmen: 
 + 
 +Diese Änderungen sind optional: 
 +  * ''http.sslbackend'' (der wert ''openssl'' funktioniert auch unter win, aber ''schannel'' ermöglicht das nutzen von Windows Certificate Stores) 
 +  * Um das Diff- bzw. Merge-Tool von Visual Studio zu benutzen: ''diff.tool'', ''merge.tool'', ''difftool "vsdiffmerge".cmd'' und ''mergetool "vsdiffmerge".cmd'' 
 + 
 +<code ini .gitconfig>
 [http] [http]
  sslbackend = schannel  sslbackend = schannel
 [gpg] [gpg]
  program = "C:/Program Files (x86)/GnuPG/bin/gpg.exe"  program = "C:/Program Files (x86)/GnuPG/bin/gpg.exe"
 +[diff]
 + tool = vsdiffmerge
 +[merge]
 + tool = vsdiffmerge
 +[difftool "vsdiffmerge"]
 + cmd = \"C:\\Program Files\\Microsoft Visual Studio\\2022\\Professional\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\vsdiffmerge.exe\" \"$LOCAL\" \"$REMOTE\" //t
 + keepBackup = false
 +[mergetool "vsdiffmerge"]
 + cmd = \"C:\\Program Files\\Microsoft Visual Studio\\2022\\Professional\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\vsdiffmerge.exe\" \"$REMOTE\" \"$LOCAL\" \"$BASE\" \"$MERGED\" //m
 + keepBackup = false
 + trustExitCode = true
 +
 </code> </code>
  
Zeile 364: Zeile 413:
 ==== GPG konfigurieren ==== ==== GPG konfigurieren ====
  
-siehe [[gpg|GPG]]+siehe [[::EDV:GPG (GnuPG)]] 
 + 
 +gpg programm unter linux: 
 +  > git config --global gpg.program gpg 
 + 
 +**stark empfohlen, da das in git integrierte gpg nicht aktuell ist:** 
 +gpg programm unter windows (''%%winget install -e --id GnuPG.GnuPG%%''): 
 +  > git config --global gpg.program "C:/Program Files (x86)/GnuPG/bin/gpg.exe" 
 + 
 +gpg **signingkey** für git herausfinden (16-stellig, steht hinter ''%%sec   4096R/%%'' oder ''%%sec   rsa4096/%%''): 
 +  > gpg -K --keyid-format=long 
 +  /home/USER/.gnupg/pubring.kbx 
 +  ------------------------------ 
 +  sec   rsa4096/XXXXXXXXXXXXXXXX 2022-01-01 [SC] 
 +        xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
 +  uid                 [ultimate] Masterflitzer (Key for GitHub and Development) <USERNAME@users.noreply.github.com> 
 +  ssb   rsa4096/0000000000000000 2021-12-02 [E] 
 + 
 +gpg key in git hinterlegen und automatisches signieren aktivieren: 
 +  > git config --global user.signingkey XXXXXXXXXXXXXXXX 
 +  > git config --global commit.gpgsign true 
 + 
 +gpg public key im ascii format (armored) exportieren (z.b. für github): 
 +  > gpg --armor --export XXXXXXXXXXXXXXXX
  
  
/home/http/wiki/data/attic/git.1657477235.txt · Zuletzt geändert: von david