How to override Git config options by command line parameters?

I want to override certain Git config options (in my case http.proxy) when calling a Git command directly by using command line parameters. Is this possible?

  • How to programmatically configure a Git branch's description?
  • How change default SVN username and password to commit changes?
  • How to make git diff --ignore-space-change the default
  • Setting up Git for Development and Test Branch with different config files
  • Where does git config --global get written to?
  • Better way of making Git to turn a blind eye on my changes
  • Why did --cached option on filter-branch remove files from working directory?
  • How to save a git commit message from windows cmd?
  • How to perform a git diff on some files only between 2 commits
  • Git work flow with an inexperienced member
  • symbolic link to specific git reference
  • Upgrading git with brew gives: No such file or directory - /usr/local/Cellar/git?
  • 2 Solutions collect form web for “How to override Git config options by command line parameters?”

    Yes, you can pass it with -c, like:

    git -c http.proxy=someproxy clone

    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, that is until git 2.1.2 (Sept 30th, 2014), and commit a789ca7 Junio C Hamano (gitster)

    config: teach “git -c” to recognize an empty string

    In a config file, you can do:


    to turn the “” boolean flag on, and you can do:


    to set “” to the empty string.
    However, git’s “-c” parameter treats both:

    git -c


    git -c

    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.

    Git Baby is a git and github fan, let's start git clone.