gitプロキシをデフォルト構成にリセットします


87

HTTP CONNECTプロキシを介してGitプロトコルを使用するようにSocatをインストールしてからgitproxy、binディレクトリに呼び出されるスクリプトを作成します。

#!/bin/sh
# Use socat to proxy git through an HTTP CONNECT firewall.
# Useful if you are trying to clone git:// from inside a company.
# Requires that the proxy allows CONNECT to port 9418.
#
# Save this file as gitproxy somewhere in your path (e.g., ~/bin) and then run
# chmod +x gitproxy
# git config --global core.gitproxy gitproxy
#
# More details at https://www.emilsit.net/blog/archives/how-to-use-the-git-protocol-through-a-http-connect-proxy/

# Configuration. Common proxy ports are 3128, 8123, 8000.
_proxy=proxy.yourcompany.com
_proxyport=3128

exec socat STDIO PROXY:$_proxy:$1:$2,proxyport=$_proxyport

次に、それを使用するようにgitを構成しました。

$ git config --global core.gitproxy gitproxy

gitをデフォルトのプロキシ構成にリセットしたいのですが、どうすればよいですか?

回答:


92

次の方法でその構成を削除できます。

git config --global --unset core.gitproxy

18
私にgit config --global --unset http.proxyはうまくいきません..私は使用しました、そしてすべてが大丈夫です
Ghassen 2018

git config --global --unsethttp.proxyも私のために働いた。
マヤンク

173

私にとって、私は追加しなければなりませんでした:

git config --global --unset http.proxy

基本的に、次を実行できます。

git config --global -l 

定義されているすべてのプロキシのリストを取得し、「-unset」を使用してそれらを無効にします


5
httpsの場合は、git config --global --unset https.proxy
Abhishek Dhote 2014

2
厄介なことの1つ--unsetは、セクションの見出しが残るため、複数の空の[http]セクションがを汚染してしまう可能性があること.gitconfigです。見出しを含むセクションconfig --global --remove-section http全体を削除するために使用し[http]ます。
thdoan 2016年

21

.gitconfigファイル(おそらくユーザーのホームディレクトリにある〜)を編集し、httpおよびhttpsプロキシフィールドをスペースのみに変更します

[http]
    proxy = 
[https]
    proxy = 

それは窓の中で私のために働いた。


20

私のLinuxマシンの場合:

git config --system --get https.proxy (returns nothing)
git config --global --get https.proxy (returns nothing)

git config --system --get http.proxy (returns nothing)
git config --global --get http.proxy (returns nothing)

https_proxyとhttp_proxyが設定されていることがわかったので、設定を解除しました。

unset https_proxy
unset http_proxy

私のWindowsマシンの場合:

set https_proxy=""
set http_proxy=""

オプションで、setxを使用してWindowsで環境変数を永続的に設定し、「/ m」を使用してシステム環境を設定します。

setx https_proxy=""
setx http_proxy=""

12

コマンドを使用して、httpとhttpsの両方の設定を削除します。

git config --global --unset http.proxy

git config --global --unset https.proxy



0

Powershellコマンドを使用してWindowsマシンにプロキシを設定したことがある場合は、以下を実行すると役に立ちました。

プロキシの使用を解除するには:1。PowerShellを開きます。2。次のように入力します。

[Environment]::SetEnvironmentVariable(“HTTP_PROXY”, $null, [EnvironmentVariableTarget]::Machine)
[Environment]::SetEnvironmentVariable(“HTTPS_PROXY”, $null, [EnvironmentVariableTarget]::Machine)

するために設定されたプロキシを再び使用します。1. 2.は次のように入力してPowerShellの:

[Environment]::SetEnvironmentVariable(“HTTP_PROXY”, “http://yourproxy.com:yourportnumber”, [EnvironmentVariableTarget]::Machine)
[Environment]::SetEnvironmentVariable(“HTTPS_PROXY”, “http://yourproxy.com:yourportnumber”, [EnvironmentVariableTarget]::Machine)
弊社のサイトを使用することにより、あなたは弊社のクッキーポリシーおよびプライバシーポリシーを読み、理解したものとみなされます。
Licensed under cc by-sa 3.0 with attribution required.