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
53
votes
4 answers

Local git config not overriding global user for project

I have a global git user configured, but want to use a different user for a single git project. Within that project, I've used git config --local user.name "localuser" and git config --local user.email "localuser@example.com" to set the local…
amacrobert
  • 2,707
  • 2
  • 28
  • 37
53
votes
5 answers

Using Git on Windows, behind an HTTP proxy, without storing proxy password on disk

I'm using Git on Windows, on a corporate network where I'm behind an HTTP proxy with Basic authentication. Outbound SSH doesn't work, so I have to use HTTPS through the proxy. I'm aware of how to use git config http.proxy to configure the settings…
ajd
  • 982
  • 1
  • 8
  • 19
43
votes
2 answers

What is the priority regarding git configuration?

If I set configuration on my ~/.gitconfig file, which config would override it? project level config : .git/config system level config : /etc/gitconfig
djangofan
  • 28,471
  • 61
  • 196
  • 289
43
votes
1 answer

Always use the pager for git diff

I'm using less as my Git pager. If the git diff output is readable on one page, my Git prints the output to the screen. Sometimes I'm too fast with typing Ctrl + D (half page down), which kills my terminal. Is there an option to enable the pager for…
Dave Halter
  • 15,556
  • 13
  • 76
  • 103
41
votes
7 answers

Can gitconfig options be set conditionally?

Via Github I use the same set of "dot files" on several different computers and servers. On the Macs and Linux boxes under my direct control I have Sublime Text 2 installed and set up as my git merge and commit editor of choice. However, on remote…
Mark Nichols
  • 1,407
  • 2
  • 19
  • 25
36
votes
3 answers

Windows-specific Git configuration settings; where are they set?

I've read the Git documentation and Where do the settings in my Git configuration come from? and yet I still can't make sense of some of my settings. I'm on Git 2.5.3 on Windows 10. Here's the output of git config -l: λ git config…
Ben Collins
  • 20,538
  • 18
  • 127
  • 187
34
votes
3 answers

What is the difference between global and local configuration in git?

I am a beginner to Git. I go through the internet and find those. What I know are Local -: Values in this file apply to a single repository. Global -: Configuration values in this file are applied to a single user. Can I know any other…
Kalana
  • 5,631
  • 7
  • 30
  • 51
33
votes
4 answers

What is git hawser?

I recently discovered my .gitconfig had been appended these few additional lines: [filter "hawser"] clean = git hawser clean %f smudge = git hawser smudge %f required = true Since it is version-controlled, I am sure I did not add them.…
MattiSG
  • 3,796
  • 1
  • 21
  • 32
33
votes
12 answers

VS 2015 + Bower: Does not work behind firewall

Problem In Visual Studio 2015, using bower, my package restores fail when behind a firewall with an error similar to: ECMDERR Failed to execute "git ls-remote --tags --heads git://github.com/jzaefferer/jquery-validation.git", exit code of…
SeanKilleen
  • 8,809
  • 17
  • 80
  • 133
32
votes
8 answers

Delete username from a Git repository

I am getting this warning when I try to set my user name in Tower: warning: user.name has multiple values I have checked in a terminal window and found that I have three usernames: macmini:HiBye shannoga$ git config --get-all…
shannoga
  • 19,649
  • 20
  • 104
  • 169
32
votes
1 answer

How to configure "git pull --ff-only" and "git merge --no-ff"

A typical git workflow for me is to clone a remote repository and use git pull to keep it up-to-date. I don't want merge commits when I pull, so i use the --ff-only option. I also make local branches for feature work. I want to preserve the branch…
Robert Huffman
  • 367
  • 1
  • 3
  • 6
32
votes
6 answers

Git configuration user.name doesn't work

I installed Git for Windows 7 today. I don't know much about Git yet and I'm following http://git-scm.com/book/en/Getting-Started-First-Time-Git-Setup and videos from YouTube on that subject. On the videos people install Git and go to the command…
Jimsea
  • 585
  • 1
  • 6
  • 11
32
votes
16 answers

Git warning: unable to access 'P:\/.gitconfig': Invalid argument

I am just testing git. I ran the following command: git config user.email "test@mail.com" I now get this when git status and others: C:\gitg\g1>git status warning: unable to access 'P:\/.gitconfig': Invalid argument warning: unable to access…
Chris G.
  • 23,930
  • 48
  • 177
  • 302
31
votes
4 answers

Git create remote repository on push

I have been trying to figure this one out but I am having a hard time doing so. I am currently working on an open source project that requires me to allow a user to push to remote repository without it already existing there. I want to avoid…
Michael van Rooijen
  • 6,683
  • 5
  • 37
  • 33
30
votes
3 answers

Setting up and using Meld as your git difftool and mergetool on a Mac

How can I install Meld on MacOS, and then set it up as my difftool and mergetool in git?
Sivaram Yadav
  • 3,141
  • 3
  • 13
  • 15
1 2
3
42 43