Git Configuration Flashcards
Q: How do you set a global username in Git?
A: Use git config –global user.name “Your Name”.
Q: How do you set a global email in Git?
A: Use git config –global user.email “your_email@example.com”.
Q: What is the purpose of .gitconfig?
A: It stores configuration settings for Git, either globally or locally for a specific repository.
Q: How do you view all global Git configurations?
A: Use git config –list –global.
Q: How do you view all local Git configurations for a repository?
A: Use git config –list –local.
Q: What is the command to edit the global Git configuration file?
A: Use git config –global –edit.
Q: How do you configure Git to use a specific text editor globally?
A: Use git config –global core.editor “editor_command” (e.g., nano, vim, code).
Q: How do you configure Git to use a specific merge tool?
A: Use git config –global merge.tool “tool_name”.
Q: What does core.autocrlf do in Git configuration?
A: It ensures consistent line endings across different operating systems. Use true for Windows or input for Unix-based systems.
Q: How do you set the default branch name for new repositories?
A: Use git config –global init.defaultBranch main.
Q: What does core.ignorecase configure?
A: It determines whether Git is case-sensitive when tracking file names. Set to true to ignore case differences.
Q: How do you enable colored output in Git?
A: Use git config –global color.ui auto.
Q: How do you configure Git to cache your credentials?
A: Use git config –global credential.helper cache.
Q: How do you configure Git to remember your credentials permanently?
A: Use git config –global credential.helper store.
Q: What does push.default configure in Git?
A: It sets the default behavior for git push. Common values are simple, current, and matching.