出现问题:
在执行 flutter upgrade
时出现 fatal: unable to access 'https://github.com
示例
ming@bogon ~ % flutter upgrade
ProcessException: Process exited abnormally:
fatal: unable to access 'https://github.com/flutter/flutter.git/': Failed to
connect to github.com port 443: Operation timed out
Command: git fetch --tags
解决方案:
方案1:
在开启shadowsocks的前提下,手动配置git的代理。git客户端输入如下两个命令就可以了。
git config --global http.proxy http://127.0.0.1:1080
git config --global https.proxy http://127.0.0.1:1080
⚠️注意:http://127.0.0.1:1080
为shadowsocks 中HTTP代理设置中设置的地址与端口。
如下图:

http://也可以改成sockets5://,但是区别在于:socks5不支持通过pubkey免密登录github,每次提交代码只能输入用户名和密码。http可以支持免密登录。
取消代理:
git config --global --unset http.proxy
git config --global --unset https.proxy
方案2:
1、看看你的git配置
git config --global -l
如果你没有任何与https代理相关的内容,例如https_proxy = …问题不在这里。
如果您有与https代理相关的内容,请将其从〜/ .gitconfig文件中删除,然后重试。
2、如果仍然不起作用,请取消设置环境变量
env|grep -i proxy
你应该有一行或几行https_proxy = …
使用以下内容逐个取消设置:取消设置https_proxy(或HTTPS_PROXY,具体取决于变量的名称)
3、再次检查环境变量
env|grep -I proxy
如果它没有显示任何你应该是好的。
注意:此解决方案可以应用于http和https代理问题。只是变量名称从https更改为http。
方案一和方案二是同一种方法,推荐使用方案1进行解决。
网友评论