Skip to content

Conversation

TopView
Copy link
Contributor

@TopView TopView commented Nov 19, 2018

The config paths as they were didn't work for me on Debian Stretch. So added paths for them.
Also added a command to show all current settings and where they're coming from. Ref: https://stackoverflow.com/questions/2114111/where-does-git-config-global-get-written-to

Also paralleled text for 3 items, and bold faced heading for Windows.

The config paths as they were didn't work for me on Debian Stretch.  So added paths for them.
Also added a command to show all current settings and where they're coming from.  Ref: https://stackoverflow.com/questions/2114111/where-does-git-config-global-get-written-to

Also paralleled text for 3 items, and bold faced heading for Windows.
These variables can be stored in three different places:

1. `/etc/gitconfig` file: Contains values applied to every user on the system and all their repositories.
1. `/etc/gitconfig` (/usr/local/etc/gitconfig on Debian): Contains values applied to every user on the system and all their repositories.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utterly false, Debian is no different:

$ sudo /usr/bin/git config --system --add foo.bar foo
$ cat /etc/gitconfig 
[foo]
        bar = foo

If you pass the option `--system` to `git config`, it reads and writes from this file specifically.
(Because this is a system configuration file, you would need administrative or superuser privilege to make changes to it.)
2. `~/.gitconfig` or `~/.config/git/config` file: Values specific personally to you, the user.
2. `~/.gitconfig` or `~/.config/git/config` (note ~ is root's home dir): Contains values specific personally to you, the user.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only if the current user is root (which should not happen), otherwise, it's current user's home dir.

$sudo git config --list --show-origin
----

*Windows:* Git looks for the `.gitconfig` file in the `$HOME` directory (`C:\Users\$USER` for most people).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same as for Linux users, so I guess it's useless to specify the case of Windows.

[source,console]
----
$sudo git config --list --show-origin
----
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


[source,console]
----
$sudo git config --list --show-origin
Copy link
Contributor

@aollier aollier Mar 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git config need not to be run with su privileges.

@ben ben closed this in #1236 Mar 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants