git – Could not resolve proxy:

In work I have a proxy, at home I don’t have a proxy

In work I set the proxy like:

  • How can I use Visual Studio to work with a Node.js project from an Openshift Git repository?
  • Does GitHub Enterprise support shallow cloning?
  • Overwrite unstaged commits due to gitattributes eol settings
  • Jenkins Git plugin detached HEAD
  • updating submodules with git-flow
  • Unauthorized Fingerprint
  •     git config - -global  http.proxy  http://proxy.theaddress.co.uk:8080
        git config - -global  https.proxy  https://proxy.theaddress.co.uk:8080
    

    At home I remove the proxy like

        git config --global --unset http.proxy
        git config --global --unset https.proxy
    

    I’m trying to push something to my git repo with

        git push -u origin master
    

    And I get

        Could not resolve proxy: proxy.theaddress.co.uk
    

    The .gitconfig file looks like this.

        [user]
            name = first last
            email = first.last@sitname.co.uk
        [http]
        [https]
        [push]
            default = current
        [http]
        [core]
            excludesfile = /Users/first.last/.gitignore_global
        [difftool "sourcetree"]
            cmd = opendiff \"$LOCAL\" \"$REMOTE\"
            path = 
        [mergetool "sourcetree"]
            cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
            trustExitCode = true
        [http]
        [https]
        [http]
        [https]
        [http]
        [https]
        [http]
        [https]
        [http]
        [https]
        [filter "media"]
            clean = git media clean %f
            smudge = git media smudge %f
            required = true
        [http]
        [https]
        [https]
        [http]
        [http]
        [https]
        [http]
    

    How do I remove the proxy ?

  • Cordova Custom Plugin “Arguments to path.join must be strings”
  • Git workflow with upstream and origin and Heroku staging and production
  • Where should I upload the built file of a github branch?
  • Keep remote directory up to date using git
  • Managing releases on github
  • How to tell git to ignore subdirectories (which are part of the repository) for operations like git status
  • 3 Solutions collect form web for “git – Could not resolve proxy:”

    Check the environment variables with :

    $echo $http_proxy
    $echo $https_proxy
    $echo $HTTPS_PROXY
    $echo $HTTP_PROXY
    

    if any of these environment variables are set then unset them by just using http_proxy= then enter will unset those

    $export http_proxy=
    
    • If below variables are set just delete all when working on network without proxy (Example @home)

      //Computer=>System properties=>Advanced=>Environment Variables
      
      http_proxy,https_proxy,HTTPS_PROXY,HTTP_PROXY
      
    • Unset git proxy

      git config --global --unset http.proxy
      git config --global --unset https.proxy
      

    Both steps together worked for me in Windows.

    Similar to other answers (especially the one by @harip) but if you’re on a Mac or such, check the .bash_profile file in the user’s home directory (e.g. cat ~/.bash_profile).
    Mine had these set during another program’s install:

    export HTTP_PROXY=http://proxy.somewhere.com:80
    
    export HTTPS_PROXY=http://proxy.somewhere.com:80
    

    Move that file to the side (e.g. mv ~/.bash_profile ~/.bash_profile-hide).
    Then start a new Terminal window (which will reload environment variables). If you don’t start a new Terminal window, any existing ones will still have the variables set and need to be cleared manually.

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