I want to override certain Git configuration options (in my case http.proxy
) when calling a Git command directly by using command line parameters. Is this possible?
If you want to check your configuration settings, you can use the git config --list command to list all the settings Git can find at that point: $ git config --list user.name=John Doe user.
The global git config is simply a text file, so it can be edited with whatever text editor you choose. Open, edit global git config, save and close, and the changes will take effect the next time you issue a git command. It's that easy.
Git stores all global configurations in . gitconfig file, which is located in your home directory. To set these configuration values as global, add the --global option, and if you omit --global option, then your configurations are specific for the current Git repository. You can also set up system wide configuration.
Yes, you can pass it with -c
, like:
git -c http.proxy=someproxy clone https://github.com/user/repo.git
Note that there is a new feature regarding the ability to override (with the command git -c
) a config:
You couldn't set a config to an empty string (git -c http.proxy=
or any other foo.bar=
), that is until git 2.1.2 (Sept 30th, 2014), and commit a789ca7 Junio C Hamano (gitster
)
git -c
" to recognize an empty stringIn a config file, you can do:
[foo] bar
to turn the "
foo.bar
" boolean flag on, and you can do:
[foo] bar=
to set "
foo.bar
" to the empty string.
However, git's "-c
" parameter treats both:
git -c foo.bar
and
git -c foo.bar=
as the boolean flag, and there is no way to set a variable to the empty string.
This patch enables the latter form to do that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With