Advanced User Settings
Credential Management
Configuring Credential Storage
## Set credential helper
git config --global credential.helper cache
## Set credential cache timeout (15 minutes)
git config --global credential.helper 'cache --timeout=900'
## Use system keychain for secure storage
git config --global credential.helper osxkeychain
graph TD
A[Credential Management] --> B[Cache Method]
A --> C[Keychain Method]
A --> D[Store Method]
SSH Key Configuration
Generating SSH Keys
## Generate SSH key
ssh-keygen -t ed25519 -C "[email protected]"
## Start SSH agent
eval "$(ssh-agent -s)"
## Add SSH key to agent
ssh-add ~/.ssh/id_ed25519
Advanced Git Configurations
Configuration |
Command |
Purpose |
Line Ending Handling |
git config --global core.autocrlf input |
Manage cross-platform line endings |
Default Pull Strategy |
git config --global pull.rebase true |
Maintain linear project history |
Ignore File Permissions |
git config --global core.fileMode false |
Ignore file permission changes |
Commit Signing and Security
GPG Key Setup
## List GPG keys
gpg --list-secret-keys --keyid-format=long
## Configure Git to use GPG signing
git config --global user.signingkey YOUR_GPG_KEY_ID
## Enable commit signing
git config --global commit.gpgsign true
## Enable Git's auto garbage collection
git config --global gc.auto 256
## Set maximum pack size
git config --global pack.packSizeLimit 2g
Multiple User Profiles
Creating Multiple Profiles
## Personal profile
git config --global user.name "Personal Name"
git config --global user.email "[email protected]"
## Work profile
git config --local user.name "Work Name"
git config --local user.email "[email protected]"
Aliases and Productivity
## Create custom Git aliases
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.st status
LabEx recommends mastering these advanced configurations to optimize your Git workflow and enhance version control productivity.