# Edward Chu - macOS 给 Git(Github) 设置代理(http/Ssh) (Highlights)

## Metadata
**Cover**:: https://readwise-assets.s3.amazonaws.com/static/images/article1.be68295a7e40.png
**Source**:: #from/readwise
**Zettel**:: #zettel/fleeting
**Status**:: #x
**Authors**:: [[Edward Chu]]
**Full Title**:: macOS 给 Git(Github) 设置代理(http/Ssh)
**Category**:: #articles #readwise/articles
**Category Icon**:: 📰
**URL**:: [gist.github.com](https://gist.github.com/chuyik/02d0d37a49edc162546441092efae6a1)
**Host**:: [[gist.github.com]]
**Highlighted**:: [[2021-03-10]]
**Created**:: [[2022-09-26]]
## Highlights
### 一、HTTP 形式
#### 走 HTTP 代理
- git config --global http.proxy "http://127.0.0.1:8080"
git config --global https.proxy "http://127.0.0.1:8080"
#### 走 socks5 代理
- git config --global http.proxy "socks5://127.0.0.1:1080"
git config --global https.proxy "socks5://127.0.0.1:1080"
### 二、SSH 形式
- # 必须是 github.com
Host github.com
HostName github.com
User git
# 走 HTTP 代理
# ProxyCommand socat - PROXY:127.0.0.1:%h:%p,proxyport=8080
# 走 socks5 代理(如 Shadowsocks)
# ProxyCommand nc -v -x 127.0.0.1:1080 %h %p
### 对于Windows用户,要使用socks5代理却没有 nc 的
- ProxyCommand connect -S 127.0.0.1:1080 %h %p
#c2