What does git config --global user.name do?

What does git config --global user.name do?

a) Sets the user’s name for all Git repositories on the system
b) Displays the current user name
c) Adds a username to the local repository
d) Configures the remote repository username

Answer:

a) Sets the user’s name for all Git repositories on the system

Explanation:

The git config --global user.name command sets the user’s name for all Git repositories on the system. This name will be associated with your commits and is used to identify you as the author of those commits.

For example, running git config --global user.name "John Doe" sets your name globally, so it will appear in the author field of all future commits.

Setting the username is a crucial step in configuring Git to ensure that your commits are properly attributed to you.

Reference:

Top 100 Git and GitHub MCQ Questions and Answers

Scroll to Top