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.
# 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_Store
Thumbs.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