git über einen Proxy: HTTP und SOCKS5
Git behandelt Proxys unterschiedlich über HTTPS und über SSH. Dieser Leitfaden behandelt beides: http.proxy für HTTPS-Remotes (einschließlich SOCKS5) und einen ProxyCommand für SSH-Remotes – mit hostbezogener Einschränkung, sodass nur der richtige Datenverkehr geleitet wird.
HTTPS-Remotes vs SSH-Remotes
How you proxy git depends entirely on your remote's protocol. For HTTPS remotes (URLs like https://github.com/...), git uses libcurl, so it honours the http.proxy config and the standard http_proxy environment variables — and because it is libcurl, it accepts a SOCKS5 proxy via the socks5h:// scheme just like curl does. For SSH remotes (git@github.com:...), git is not involved in the networking at all; SSH is, so you configure a ProxyCommand in your SSH config to tunnel the connection.
Mit s4m haben Sie beide Endpunkte: SOCKS5 auf Port 1080 und HTTP auf Port 3128, authentifiziert mit USER:PASS gegen proxy.s4m.online. Für HTTPS-Remotes bleibt socks5h:// DNS remote; für SSH leitet ein ProxyCommand, das nc oder ncat verwendet, den SSH-Stream durch SOCKS5. Siehe die Proxy-Seite und was ist SOCKS5; die gleiche ProxyCommand Idee erscheint im Vergleich SOCKS5 vs HTTP.
git über HTTPS und SSH, proxied
http.proxy für HTTPS-Remotes (SOCKS5 oder HTTP), plus ein ProxyCommand für SSH. Per-URL-Scoping vermeidet das Proxieren von allem. Ersetzen Sie USER:PASS.
# --- HTTPS remotes: SOCKS5 with remote DNS ---
git config --global http.proxy socks5h://USER:PASS@proxy.s4m.online:1080
# or the HTTP proxy:
git config --global http.proxy http://USER:PASS@proxy.s4m.online:3128
# --- Scope the proxy to ONE host only (leave the rest direct) ---
git config --global http.https://github.com/.proxy \
socks5h://USER:PASS@proxy.s4m.online:1080
# --- Remove the proxy later ---
git config --global --unset http.proxy
# --- SSH remotes: tunnel git@... through SOCKS5 via ~/.ssh/config ---
cat >> ~/.ssh/config <<'CFG'
Host github.com
HostName github.com
User git
ProxyCommand nc -X 5 -x proxy.s4m.online:1080 %h %p
CFG
# -X 5 = SOCKS5; nc/ncat must be installed.
# --- One-off, no persistent config ---
git -c http.proxy=socks5h://USER:PASS@proxy.s4m.online:1080 clone https://example.com/repo.gitProxy-Git auf die richtige Weise
Wähle zuerst deinen Remote-Typ, dann wende die passende Konfiguration an.
Identifiziere dein Remote-Protokoll
Führen Sie git remote -v aus. Eine https:// URL verwendet http.proxy; eine git@host: URL verwendet SSH, was einen ProxyCommand benötigt.
Für HTTPS, setzen Sie http.proxy
Verwenden Sie git config --global http.proxy mit socks5h://proxy.s4m.online:1080 für Remote-DNS oder den HTTP-Endpunkt auf 3128. Beschränken Sie es pro URL, wenn Sie nur einen Host proxyn möchten.
Für SSH fügen Sie einen ProxyCommand hinzu
Fügen Sie in ~/.ssh/config unter dem entsprechenden Host-Block ProxyCommand nc -X 5 -x proxy.s4m.online:1080 %h %p hinzu. Installieren Sie nc/ncat, falls es fehlt.
Überprüfen Sie mit einem Klon
Klonen Sie ein kleines Repository und bestätigen Sie, dass es erfolgreich ist. Wenn es hängt, überprüfen Sie den Endpunkt und die Anmeldeinformationen erneut und stellen Sie sicher, dass Sie das richtige Protokoll festgelegt haben.
Pro-Host-Scoping, Authentifizierung und Ehrlichkeit
You rarely want to route all git traffic through a proxy. git supports per-URL proxy config — http.https://github.com/.proxy applies a proxy only to that host, leaving other remotes direct. That keeps internal mirrors fast while an external host goes through the proxy. Credentials live inline in the proxy URL; if your password has special characters, URL-encode them.
s4m-Proxys sind authentifizierte Rechenzentrum SOCKS5- und HTTP-Endpunkte, nach Verbrauch abgerechnet — eine solide Wahl für CI-Runner, die Abhängigkeiten von hinter einem kontrollierten Ausgang klonen, oder um einen git-Host aus einem eingeschränkten Netzwerk zu erreichen. Sie sind Rechenzentrum, nicht Wohnsitz, und ein Proxy ändert nur Ihren Netzwerkpfad, nicht Ihre git-Anmeldeinformationen oder SSH-Schlüssel. Wenn CI eine erlaubte Ausgangs-IP benötigt, fügen Sie eine dedizierte persönliche IP hinzu. Ein 407 über HTTPS bedeutet schlechte Proxy-Anmeldeinformationen — siehe den 407-Leitfaden. Validieren Sie Endpunkte mit den Tools und lesen Sie die API-Dokumentation.
Fragen, beantwortet
Wie mache ich, dass git einen SOCKS5-Proxy verwendet?
Für HTTPS-Remotes, setzen Sie git config --global http.proxy socks5h://USER:PASS@proxy.s4m.online:1080 — git verwendet libcurl, daher akzeptiert es SOCKS5 genau wie curl. Für SSH-Remotes verwenden Sie einen ProxyCommand in ~/.ssh/config.
Funktioniert http.proxy für SSH (git@...) Remotes?
Nein. http.proxy betrifft nur HTTPS-Remotes. SSH-Remotes werden auf der SSH-Ebene mit einem ProxyCommand proxied — zum Beispiel nc -X 5 -x proxy.s4m.online:1080 %h %p für SOCKS5.
Wie proxy ich nur einen Git-Host?
Verwenden Sie die Konfiguration pro URL: git config --global http.https://github.com/.proxy
Wie entferne ich einen Git-Proxy?
Führen Sie git config --global --unset http.proxy (und jede per-URL-Variante) aus oder löschen Sie die ProxyCommand-Zeile aus ~/.ssh/config für SSH-Remotes.
Von hinter einem Proxy klonen
Authentifizierte SOCKS5 (1080) und HTTP (3128) Proxys auf proxy.s4m.online, bereit für http.proxy und SSH ProxyCommand. Abrechnung nach Verbrauch, dedizierte IP für CI-Whitelist.
Menschen fanden diese Seite durch die Suche nach
- git über einen proxy
- git über einen proxy für Anfänger
- wie man git über einen proxy überprüft
- git über einen proxy erklärt
- wie man git über einen proxy konfiguriert
- kostenlose Proxy-Liste ohne Registrierung
- beste VPN-Kill-Switch 2026
- wie man überprüft, ob ein proxy gültig ist (mit einem fertigen skript)
- wie man IP-Adresse einrichtet
- portweiterleitung über VPNs und proxys
- wie websites proxys und VPNs erkennen
- Was ist Proxy-Authentifizierung
- Proxy für Scraping Anbieter
- VPN-Kill-Switch
- frisch Proxy-Authentifizierung
Echte Suchphrasen, auf die diese Seite antwortet — die verlinkten öffnen die Seite, die sie ausführlich behandelt.