Questions tagged [git-config]

This command allows get and set repository or global options.

You can query/set/replace/unset options with this command. The name is actually the section and the key separated by a dot, and the value will be escaped.

Multiple lines can be added to an option by using the --add option. If you want to update or unset an option which can occur on multiple lines, a POSIX regexp value_regex needs to be given. Only the existing values that match the regexp are updated or unset. If you want to handle the lines that do not match the regex, just prepend a single exclamation mark in front (see also [EXAMPLES]).

The type specifier can be either --int or --bool, to make git config ensure that the variable(s) are of the given type and convert the value to the canonical form (simple decimal number for int, a "true" or "false" string for bool), or --path, which does some path expansion (see --path below). If no type specifier is passed, no checks or transformations are performed on the value.

When reading, the values are read from the system, global and repository local configuration files by default, and options --system, --global, --local and --file can be used to tell the command to read from only that location (see [FILES]).

When writing, the new value is written to the repository local configuration file by default, and options --system, --global, --file can be used to tell the command to write to that location (you can say --local but that is the default).

This command will fail with non-zero status upon error. Some exit codes are:

  • The config file is invalid (ret=3),

  • Can not write to the config file (ret=4),

  • No section or name was provided (ret=2),

  • The section or key is invalid (ret=1),

  • You try to unset an option which does not exist (ret=5),

  • You try to unset/set an option for which multiple lines match (ret=5), or

  • You try to use an invalid regexp (ret=6).

On success, the command returns the exit code 0.

This command allows get and set repository or global options.

635 questions
33 answers

How can I save username and password in Git?

I want to use a push and pull automatically in Git Extensions, Sourcetree or any other Git GUI without entering my username and password in a prompt, every time. So how can I save my credentials in Git?
Edson Cezar
  • 25,884
  • 5
  • 19
  • 27
22 answers

How do I commit case-sensitive only filename changes in Git?

I have changed a few files name by de-capitalize the first letter, as in Name.jpg to name.jpg. Git does not recognize this changes and I had to delete the files and upload them again. Is there a way that Git can be case-sensitive when checking for…
Gil Shulman
  • 20,909
  • 3
  • 13
  • 4
28 answers

Is there a way to cache https credentials for pushing commits?

I recently switched to synchronizing my repositories to https:// on GitHub (due to firewall issues), and it asks for a password every time. Is there a way to cache the credentials, instead of authenticating every time that git push?
  • 28,655
  • 4
  • 35
  • 50
33 answers

How can I deal with this Git warning? "Pulling without specifying how to reconcile divergent branches is discouraged"

After a git pull origin master, I get the following message: warning: Pulling without specifying how to reconcile divergent branches is discouraged. You can squelch this message by running one of the following commands sometime before your next…
Davide Casiraghi
  • 15,591
  • 9
  • 34
  • 56
24 answers

Can I specify multiple users for myself in .gitconfig?

In my ~/.gitconfig, I list my personal email address under [user], since that's what I want to use for Github repos. But, I've recently started using git for work, too. My company's git repo allows me to commit, but when it sends out announcements…
Brock Boland
  • 15,870
  • 11
  • 35
  • 36
14 answers

Is it possible to have different Git configuration for different projects?

.gitconfig is usually stored in the user.home directory. I use a different identity to work on projects for Company A and something else for Company B (primarily the name / email). How can I have two different Git configurations so that my check-ins…
  • 24,861
  • 26
  • 62
  • 81
13 answers

How to know the git username and email saved during configuration?

While configuring git I ran these two commands: git config --global "My Name" git config --global "" However, I doubt whether I made a typo or not. So, is there any command to know the name and email which…
Jebin Philipose
  • 8,043
  • 4
  • 9
  • 14
17 answers

How to change my Git username in terminal?

I was pushing and pulling from git in Terminal then I changed my username on I went to push some changes and it couldn't push because it was still recognizing my old username.. How do I change/update my username on git in terminal?
  • 4,803
  • 3
  • 14
  • 14
4 answers

Difference between author and committer in Git?

I am trying to make a commit like git commit --author="John Doe " -m "" where John Doe is some user in whose name I want to make the commit. It appears all right in git log. However, when I do a gitk, the…
Anshul Goyal
  • 73,278
  • 37
  • 149
  • 186
22 answers

git: 'credential-cache' is not a git command

I followed these instructions to the letter, including the part about password caching. It seems like the instructions are wrong, because every time I git push origin master I get this error: git: 'credential-cache' is not a git command. See 'get…
Big McLargeHuge
  • 14,841
  • 10
  • 80
  • 108
18 answers

How can I make Sublime Text the default editor for Git?

I have a problem setting Sublime Text 2 as the core.editor with git. I've read through every post I could find addressing the problem, but still nothing is working for me. I am running Windows. I have done: git config --global core.editor…
Spencer Moran
  • 2,530
  • 3
  • 15
  • 13
6 answers

With Git, how do I turn off the "LF will be replaced by CRLF" warning

With Git, when using the autocrlf = true flag, a warning is still given when line-endings are changed. I understand what the warning is for, and how to turn off the line-ending flag, but how do I turn off the warning itself?
  • 18,635
  • 16
  • 56
  • 74
2 answers

git multiple user names for the different projects within the same system

I have a different git repository for my office and a different git repo for my hobby projects. When I do git config --global the user name changes globally and this creates a confusion of committing to a repo with user name. Hence the…
  • 6,378
  • 14
  • 49
  • 78
9 answers

Git: can I suppress listing of 'modified content'/dirty submodule entries in status, diff, etc?

Somewhen (around the 1.6.x releases, I think) git became aware of changes inside submodules. That only serves to annoy me: $ git status vendor | grep modified: # modified: vendor/rails (modified content) $ git diff vendor/ diff --git…
  • 77,385
  • 46
  • 136
  • 148
18 answers

git: fatal unable to auto-detect email address

I just cannot commit with git on Ubuntu 14.04 Error message is: git: fatal unable to auto-detect email address (got "some wrong email") I tried git-config with and without the --global option setting and user.mail but nothing works
  • 1,643
  • 2
  • 10
  • 6
2 3
42 43