Note HTTPS asks for credentials each time unless you configure a credential helper. SSH uses your key pair and is generally preferred for frequent pushes.
Note Without --global, the setting only applies to the current repository. Your commits will be attributed to whatever name/email is configured, so double-check with git config user.email before committing to a work repo.
set usernameset emailconfigure identitywho am i in gitchange git author
Set Default Editor
Syntax
git config --global core.editor"<editor>"
Example
git config --global core.editor"code --wait"# Or for vim:git config --global core.editor"vim"
Note The --wait flag for VS Code is essential. Without it, Git thinks the editor closed immediately and aborts the commit message.
git config --globalalias.co'checkout'git config --globalalias.br'branch'git config --globalalias.lg'log --oneline --graph --all'# Now use:git co main
git lg
Note Aliases are stored in ~/.gitconfig. You can also edit that file directly under the [alias] section for complex aliases.
# macOS - use the system keychain:git config --global credential.helper osxkeychain
# Linux - cache for 1 hour:git config --global credential.helper'cache --timeout=3600'
Note The 'store' helper saves passwords in plain text on disk. Prefer 'osxkeychain' on Mac or a credential manager on Windows. For SSH repos, credentials are handled by your SSH key instead.
save passwordstop asking passwordcredential helperremember loginauthentication
Global .gitignore
Syntax
git config --global core.excludesFile<path>
Example
git config --global core.excludesFile~/.gitignore_global# Then in ~/.gitignore_global:.DS_StoreThumbs.db*.swp.idea/.vscode/
Note Use this for OS and editor-specific files. Project-specific ignores still belong in the repo's own .gitignore so all contributors benefit.
global ignoreignore everywheresystem gitignoreignore IDE files