git-无法解析代理:

git-无法解析代理:,git,proxy,Git,Proxy,在工作中我有代理人,在家里我没有代理人 在工作中,我将代理设置为: git config - -global http.proxy http://proxy.theaddress.co.uk:8080 git config - -global https.proxy https://proxy.theaddress.co.uk:8080 在家里,我移除代理,就像 git config --global --unset http.proxy git con

在工作中我有代理人,在家里我没有代理人

在工作中,我将代理设置为:

    git config - -global  http.proxy  http://proxy.theaddress.co.uk:8080
    git config - -global  https.proxy  https://proxy.theaddress.co.uk:8080
在家里,我移除代理,就像

    git config --global --unset http.proxy
    git config --global --unset https.proxy
我正试着把一些东西推到我的git回购协议上

    git push -u origin master
我得到

    Could not resolve proxy: proxy.theaddress.co.uk
.gitconfig文件如下所示

    [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]

如何删除代理?

使用以下选项检查环境变量:

$echo $http_proxy
$echo $https_proxy
$echo $HTTPS_PROXY
$echo $HTTP_PROXY
如果设置了这些环境变量中的任何一个,则只需使用
http\u proxy=
即可取消设置,然后
enter
将取消设置这些环境变量

$export http_proxy=
  • 如果设置了以下变量,则在没有代理的网络上工作时只需删除所有变量(例如@home)

  • 取消设置git代理

    git config --global --unset http.proxy
    git config --global --unset https.proxy
    
这两个步骤对我在Windows中都起到了作用。

与其他答案(特别是@harip的答案)类似,但如果你在Mac或类似的电脑上,请检查用户主目录中的.bash_配置文件(例如,
cat~/.bash_配置文件
)。 我的在另一个程序的安装过程中设置了:

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

export HTTPS_PROXY=http://proxy.somewhere.com:80
将该文件移到一旁(例如,
mv~/.bash\u profile~/.bash\u profile-hide
)。
然后启动一个新的终端窗口(将重新加载环境变量)。如果不启动新的终端窗口,任何现有窗口仍将设置变量,需要手动清除。

此问题的解决方案是删除git代理

  • 通过管理员打开终端
  • 然后点击command
    git config--global-l
  • 然后通过下面的命令取消设置所有HTTP和https代理
  • git config--global--unset所有http.proxy
    &
    git config--global--unset所有https.proxy
  • 现在,您可以使用相同的命令
    git config--global-l

是否将其定义为环境变量HTTP\u PROXY?或者在repo的本地配置(.git/config)中?我没有看到代理条目。您尝试过git config--global--unset http.proxy吗?应该有一个[http]proxy=entry,但它不是thereVonC——我想我没有将它定义为环境变量,我应该如何/在哪里检查它。unixmiah-是的,我试过git config--global--unset http.proxy,这是我的问题。我知道没有代理条目,这就是我困惑的原因。它是mac os上的http.proxy吗?Kudos@harip,它起作用了。你必须有足够的耐心来检查所有的四个版本!不要在发现两个或三个echo返回空后放弃!
export HTTP_PROXY=http://proxy.somewhere.com:80

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