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?

  • Why does git difftool use git diff instead?
  • Repository Migration to Gerrit, git push --mirror returns refs/meta/config (cannot delete project configuration)
  • Cordova install platforms/plugins from config.xml
  • SVN: How do I maintain my local config.blah file?
  • git cherry-pick -x default
  • Where is the user's Subversion config file stored on the major operating systems?
  • How to re-evaluate shell environment and re-evaluate frame-title-format before opening each buffer in emacs
  • Find all dangling commits with a given ancestor - Git
  • How to clone a git repo with all branches and tags from refs/remotes?
  • How do I use 'git rebase -i' to rebase all changes in a branch?
  • Setting up public key encryption for git ssh
  • git update hook: Finding all revs being committed
  • 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.