git 设置全局代理_Git : 代理設置

博客介绍了smart_switcher工具,它可自动判别并设置http、https、ftp、rsync、ssh、git等协议的代理,适合在有代理和无代理网络环境间切换的场景。其原理源于Git设置代理方法并简化,只需设置网关IP和Port,还说明了安装和使用方式。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

写了一个smart_switcher,可以自动判别并设置各种代理,特别适合office有代理、家里无代理各种切换的情况。

原理是根据《如何为 Git 设置代理?》来的,不过简化到超简单,只需设置你的网关IP和Port即可。

ReadMe在此。。。

smart_switcher

A auto-detect proxy switcher fot http, https, ftp, rsync, ssh, git protocols.

Overview

A smart proxy switcher wrapper, supports http, https, ftp, rsync, ssh(connect depanded), git(connect depanded) protocols. It can automatically detect your network environment and set proxy for you.

If you usually switch the network environment (maybe home with no-proxy and workplace with proxy), it may help you a lot.

Tested in zsh and bash.

Screenshot

Install

Simply source it in your .zshrc, or any shell script resource file like this:

source /path/to/smart_switcher.sh

and, make sure set your proxy_server/gateway in smart_switcher.sh.

Usage

Normally, it antomatically executes when you login in.

smart_switcher supports cecho, who will bring some colors for you.

connect is required if proxy is supported in ssh and git. You can install it easily in path /usr/bin/connect.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值