人间熙攘,好久不见

vuePress-theme-reco Magic    2017 - 2023
人间熙攘,好久不见 人间熙攘,好久不见

Choose mode

  • dark
  • auto
  • light
Home
Category
  • tools
  • Zsh
  • iTerm2
  • Front-end
  • 版本控制-Git
  • Rust
  • skia-safe
  • 第三方对接
  • MQTT
  • Powershell
  • python
  • MD5
  • SHA1
  • wsl2
Tags
TimeLine
GitHub
  • Github (opens new window)
  • Before (opens new window)
author-avatar

Magic

23

文章

15

标签

Home
Category
  • tools
  • Zsh
  • iTerm2
  • Front-end
  • 版本控制-Git
  • Rust
  • skia-safe
  • 第三方对接
  • MQTT
  • Powershell
  • python
  • MD5
  • SHA1
  • wsl2
Tags
TimeLine
GitHub
  • Github (opens new window)
  • Before (opens new window)
  • Git

    • git 一些骚操作
    • git commit emoji 使用指南
    • gitlab 搭建
    • git 设置代理
    • git 相关总结

git 设置代理

vuePress-theme-reco Magic    2017 - 2023

git 设置代理

Magic 2021-07-13 Git

Git 设置代理,记录一下

# git 设置 http | https 代理

代码如下:

# 设置全局代理
# http
git config --global https.proxy http://127.0.0.1:1080
# https
git config --global https.proxy https://127.0.0.1:1080
# 使用socks5代理的 例如ss,ssr 1080是windows下ss的默认代理端口,mac下不同,或者有自定义的,根据自己的改
git config --global http.proxy socks5://127.0.0.1:1080
git config --global https.proxy socks5://127.0.0.1:1080

# 只对 github.com 使用代理,其他仓库不走代理
git config --global http.https://github.com.proxy socks5://127.0.0.1:1080
git config --global https.https://github.com.proxy socks5://127.0.0.1:1080
# 取消github代理
git config --global --unset http.https://github.com.proxy
git config --global --unset https.https://github.com.proxy

# 取消全局代理
git config --global --unset http.proxy
git config --global --unset https.proxy

# SSH 代理

代码如下:

# 对于使用git@协议的,可以配置socks5代理
# 在 ~/.ssh/config 文件后面添加几行,没有可以新建一个
# socks5
Host github.com
User git
ProxyCommand connect -S 127.0.0.1:1080 %h %p

# http || https
Host github.com
User git
ProxyCommand connect -H 127.0.0.1:1080 %h %p
欢迎来到 人间熙攘,好久不见
看板娘