Hello! Today we are going to look at the general git configuration commands. To do this, the system has a file ~ / .gitconfig (or ~ / .config / git / config) common to all repositories. It stores the git configuration settings and is the first place the system calls to.
In order to see the options, we just need to run the following command:
gitconfig
We will be shown a general list of all options and their brief descriptions that we can add to this command. For example, with the —global option, we can force GIT to read and write to the .gitconfig configuration file.
Example:
git config —global user.name
git config —global user.email
Here we find out the name and email of the user that are specified in the configuration file or
git config —global user.name «Andrey»
git config —global user.email «andrey@mail.ru»
specify new ones by overwriting them.
You can also replace the error messages that the system gives you:
git config —global help.autocorrect «There is no such command in the git system»
With this command, we changed the standard git message that there is no such command in the system, for example:
git status
Here we wanted to write git status, but we hurried and described ourselves, as a result, our message will be displayed to us (There is no such command in the git system) which we indicated using help.autocorrect.
git config —system receive.denyDeletes true
This command prevents the user from deleting tags and branches. Now, in order to delete branches and tags, you will need to delete the files on the server manually.
And finally, I will say that for a detailed acquaintance with all the configuration commands, you can run the command:
gitconfig —help
As a result, a general guide for working with git configuration commands will open in your browser with detailed explanations and examples.