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.

534 questions
-1
votes
2 answers

How to search for a subject like this

To do a git commit with my own editor (Visual Code) I needed to setup the editor like this: git config --global --replace-all core.editor "code -w" I was searching for this a long time and found out the -w was missing after code. Without…
user8261152
-1
votes
1 answer

git config file - fatal: bad config file line 12 in .git/config

I am getting error fatal: bad config file line 12 in .git/config when I run any git command to do with git config, except when I am in /c/Windows/System32. I have tried running git bash as admin and it doesn't make a difference. When I look at my…
IdrisAH
  • 21
  • 4
-1
votes
1 answer

How to get rid of /etc/gitconfig in git?

I have two gitconfig files: /etc/gitconfig ~/.gitconfig I want to get rid of /etc/gitconfig. I can't just remove it, because I have no write permission in that directory. Is there another way to disable the gitconfig file in /etc/gitconfig?
Alan
  • 439
  • 9
  • 24
-1
votes
1 answer

Configure git to throw error on using certain characters in branch name

I recently figured that my organization's build process fails to succeed if your branch contains / in the branch name because the build process generates a file with filename _.type in folder say RootFolder. eg. Branch name:…
unrealsoul007
  • 3,046
  • 1
  • 15
  • 31
-2
votes
2 answers

How to log out of GitHub account in Git Bash?

I accidentally made a typo while logging into my GitHub after a fresh Linux installation in Git Bash. Now everytime I try to push to my GitHub account, I am unable to push it. I am using KDE Neon based on Ubuntu LTS 18.04 Can somebody help me in…
Harsh2000
  • 1
  • 3
-2
votes
1 answer

.gitignore does not hide itself, and doesnot hide a file

I have a repository, and the .gitignore is right under the repository. When I do a git status, there's annoying file src/main/resource/git.properties that keeps showing up, and sometimes blocks me from doing a git pull. I searched that .gitignore…
user2751691
  • 383
  • 2
  • 7
  • 28
-3
votes
1 answer

how can solve problem the multiple values in bitbucket?

how can solve problem the multiple values in bitbucket? The message that appeared to me warning: user.email has multiple values error: cannot overwrite multiple values with a single value Use a regexp, --add or --replace-all to change…
Aseel
  • 1
  • 3
-4
votes
1 answer

what is codecheck in gitconfig?

I have created several repository in Ubuntu, but when I do: ~/gittest1 ~/gittest2 ~/gittest3 vim ~/.gitconfig I see: user.name = Greatest Programmer user.email = Greatest_programmer@stackoverflow.com color.diff = auto color.status =…
user97662
  • 703
  • 1
  • 8
  • 21
1 2 3
35
36