How to set a Git configuration parameter when its configuration file is $ XDG_CONFIG_HOME / git / config?

With Git, version 1.9.3 on Fedora Linux, version 20, I request, for example, a username, for example:

git config user.name
# Foo Bar

But when I try to change it like this:

git config user.name 'Bar Foo'

I get the following error:

# error: could not lock config file .git/config: No such file or directory

According to the “XDG Base Directory Specification” ( http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html ) and the “FILES” section git -config (1) manpage I put my Git configuration file c "$XDG_CONFIG_HOME/git/config".

Note that the variable is "XDG_CONFIG_HOMEset "$HOME/.config", and the variable is GIT_CONFIGnot set in my environment.

, "" man- git -config (1) : " $XDG_CONFIG_HOME , $HOME/.config/git/config."

Git "$XDG_CONFIG_HOME/git/config", .. .

- ?

+4
2

( .git/config), ( XDG ).

- , . , :

$ cd /someplace/with/no/repo; git config user.name boo
error: could not lock config file .git/config: No such file or directory

, , --global.

VonC , - git 2.8.

+8

, --global, git 2.8 ( 2016 ).

. commit 638fa62 (24 2016 .) (dscho).
( Junio ​​C Hamano - gitster - commit d3faba8, 26 2016 .

git config:

, git config section.key value git worktree.

error: could not lock config file .git/config: No such file or directory

. .

, , , git config .

+1

Source: https://habr.com/ru/post/1544388/


All Articles