S
S
Sergey Burduzha2021-07-06 11:46:11
git
Sergey Burduzha, 2021-07-06 11:46:11

Why is gitconfig not working?

Good afternoon.
I want to use 2 git accounts on my machine.
Found info that you need to create several .giconfig files.

Created .gitconfig in the root of the home directory

[user]
  name = serii
  email = [email protected]
[includeIf "gitdir:~/Bludelego/"]
    path = ~/Bludelego/.gitconfig-bludelego
[push]
  default = simple
[alias]
  l = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n''          %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all


Then I created .gitconfig-bludelego in the Bludelgo folder

ryXwdso.png

And registered inside
[user]
  name = Bludelego
  email = [email protected]


Now, if I am in the home folder, then git config user.email = [email protected]
And if I am in the Bluedelego folder, then the same thing comes out, but it should be [email protected]

Why does not it work?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
iMaximus, 2021-07-06
@serii81

It does not work, apparently because the file needed to be given a normal name.
True, it is not entirely clear why creating files by hand if all the necessary data can be set with commands through the terminal or in general in the Git client if you use Sourcetree for example.

  1. The [path]/etc/gitconfig file contains values ​​that are common to all system users and all their repositories. If you specify the --system option when running git config, then the settings will be read and saved to this file. Since this file is a system file, you will need superuser rights to make changes to it.
  2. The file ~/.gitconfig or ~/.config/git/config stores the settings for a particular user. This file is used when specifying the --global option and applies to all repositories you work with on the current system.
  3. The config file in the Git directory (i.e. .git/config) of the repository you are currently using stores the settings for that particular repository. You can force Git to read and write to this file with the --local option, but this is actually the default. Not surprisingly, you need to be in a Git repository somewhere for this option to work properly.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question