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
-1
votes
1 answer

git: how to ignore symlinks?

I have a local git repo in a directory that contains soft links (Linux), and I'd like to ignore those links so that git status etc. won't bother about these links. I am using git v2.34. This answer proposes to set core.symlinks to false, which I did…
emacs drives me nuts
  • 2,785
  • 13
  • 23
-1
votes
0 answers

Fatal error: repository not found when trying to clone a repository

O objetivo era tentar clonar um repositório privado para adicionar o token de validação no sistema. Mas ao utilizar o comando git clone https://github.com/Leonan-Rocky/hello-world.git, retorna o erro: git clone…
-1
votes
1 answer

Why does the line `safecrlf = trueexport` keep getting appended to my .gitconfig file?

I have searched the bowels of the internet and have been unable to determine what could be going on here: For some reason, the line safecrlf = trueexport keeps appending to my [core] global .gitconfig settings It will often be appended multiple…
-1
votes
1 answer

How to set git config values at runtime?

Is there a way to pass git config options to commands at runtime ? Example use case: The git commit command does not have a -U option (ie. git diff) to change context lines of -v verbose output, and the user does not want to set diff.context in…
mvanle
  • 1,847
  • 23
  • 19
-1
votes
1 answer

git/ssh - Having trouble with ssh authentication with multiple users

I am having trouble getting git ssh authentication to work with multiple users. Initially, it would always try to authenticate with my home-key ~/.ssh/home-key, untill I found this…
Yenmangu
  • 71
  • 9
-1
votes
1 answer

How do I comprehend the 'all' concept in 'git push --all' and simply 'git push' but push.defaults configured to be 'matching' respectively?

I am having a bit of a hard time figuring out what the question title suggests. Basically, git push --all(or maybe less often git push --all ) and simply git push but defaulted to 'matching' both give a reference to 'all'. I did some…
J.Yan
  • 55
  • 2
  • 8
-1
votes
1 answer

setting git config for multiple project

I'm working on multiple projects and those projects are connected to different github account. my main project's config was set using git config --global user.name "firstusername" and the second project used git config user.name "secondusername".…
dapidmini
  • 1,490
  • 2
  • 23
  • 46
-1
votes
1 answer

Git Config Double Quotes in PowerShell Round 2

I'm reposting this as it is not a duplicate. Please see my edit. This was asked here, but no solution was provided for PowerShell. The solution given does not work in PowerShell (specifically, PowerShell 5.1 within VSCode). I have tried git config…
adam.hendry
  • 4,458
  • 5
  • 24
  • 51
-1
votes
1 answer

Blocked user shown in a commit detail

I use a laptop that contains an old configuration: git global credentials git config --global user.email => blockeduser@email.com so when I push my first commit with my username & password, I found the blocked user in my commit detail how this can…
OAH
  • 1,160
  • 2
  • 11
  • 24
-1
votes
1 answer

what does git man pages [] mean

I am reading the man pages of git-config , you can check it here too. https://www.git-scm.com/docs/git-config/1.8.3 In synopsis , I am unable to understand what does [] mean , I have tried to look into its details of the man pages but…
Aqeel Raza
  • 1,729
  • 4
  • 15
  • 24
-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
  • 6
-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
  • 469
  • 10
  • 26
-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,809
  • 1
  • 17
  • 33
-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
  • 4
1 2 3
42
43