You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows代理环境下Okteto无法下载syncthing等所需文件问题咨询

问题描述

我正尝试在Visual Studio Code中部署Okteto环境,用于在Kubernetes上进行远程开发。

按照官方教程操作,执行Okteto: up命令并选择清单文件vscode-remote-go/okteto.yml后,遇到如下报错:

Installing dependencies...  
 x  couldn't download syncthing, please try again

调整日志级别后,获取到如下详细日志:

C:\Users\user\AppData\Local\Programs\okteto.exe up -f 'c:\Workspace\...my_project...\vscode-remote-go\okteto.yml' --remote '22100' --loglevel=debug
time="2021-09-13T14:09:32+09:00" level=info msg="starting up command"
time="2021-09-13T14:09:32+09:00" level=info msg="failed to get latest version from github: fail to get releases from github: Get \"https://api.github.com/repos/okteto/okteto/releases?per_page=5\": dial tcp: lookup api.github.com: no such host"
Installing dependencies...
time="2021-09-13T14:09:32+09:00" level=info msg="installing syncthing for windows/amd64"
time="2021-09-13T14:09:32+09:00" level=info msg="failed to download syncthing, retrying: failed to download syncthing from https://github.com/syncthing/syncthing/releases/download/v1.10.0/syncthing-windows-amd64-v1.10.0.zip: Get \"https://github.com/syncthing/syncthing/releases/download/v1.10.0/syncthing-windows-amd64-v1.10.0.zip\": dial tcp: lookup github.com: no such host"
time="2021-09-13T14:09:33+09:00" level=info msg="installing syncthing for windows/amd64"
time="2021-09-13T14:09:33+09:00" level=info msg="failed to download syncthing, retrying: failed to download syncthing from https://github.com/syncthing/syncthing/releases/download/v1.10.0/syncthing-windows-amd64-v1.10.0.zip: Get \"https://github.com/syncthing/syncthing/releases/download/v1.10.0/syncthing-windows-amd64-v1.10.0.zip\": dial tcp: lookup github.com: no such host"
time="2021-09-13T14:09:34+09:00" level=info msg="installing syncthing for windows/amd64"
time="2021-09-13T14:09:34+09:00" level=info msg="failed to upgrade syncthing: failed to download syncthing from https://github.com/syncthing/syncthing/releases/download/v1.10.0/syncthing-windows-amd64-v1.10.0.zip: Get \"https://github.com/syncthing/syncthing/releases/download/v1.10.0/syncthing-windows-amd64-v1.10.0.zip\": dial tcp: lookup github.com: no such host"
time="2021-09-13T14:09:34+09:00" level=info msg="couldn't download syncthing, please try again"
 x  couldn't download syncthing, please try again

我的运行环境处于企业代理之后,直接访问报错中的URL可通过代理正常下载,推测okteto.exe未读取Windows系统的代理配置导致下载失败。请问是否可以在代理环境下正常使用Okteto?


解答

可以在代理环境下正常使用Okteto,该报错的核心原因是Okteto默认读取环境变量中的代理配置,不会自动读取Windows系统层面的代理设置,可通过以下方法解决:

  • 方法一:临时配置终端代理(仅当前终端生效)

    若使用CMD终端,执行以下命令:

    set HTTP_PROXY=http://替换为你的代理地址:替换为代理端口
    set HTTPS_PROXY=http://替换为你的代理地址:替换为代理端口
    

    若使用PowerShell终端,执行以下命令:

    $env:HTTP_PROXY = "http://替换为你的代理地址:替换为代理端口"
    $env:HTTPS_PROXY = "http://替换为你的代理地址:替换为代理端口"
    

    代理需要账号认证的话,地址格式改为http://用户名:密码@代理地址:端口。配置完成后在同一终端内执行okteto up命令即可。

  • 方法二:永久配置系统环境变量(所有终端生效)

    1. 右键「此电脑」选择「属性」,点击「高级系统设置」→「环境变量」
    2. 新建两个系统变量:HTTP_PROXY和HTTPS_PROXY,变量值填写你的代理地址
    3. 配置完成后重启VS Code或终端即可生效
  • 方法三:手动安装Syncthing兜底

    如果代理配置后仍然下载失败,可手动下载对应版本的Syncthing压缩包,解压后将syncthing.exe文件放到C:\Users\你的用户名\.okteto\bin目录下,后续执行okteto up时不会再触发自动下载逻辑。

如果代理使用自签名证书,可将代理的根证书导入到系统「受信任的根证书颁发机构」列表中,避免证书校验失败。


内容的提问来源于stack exchange,提问作者Daigo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.04 11:18:04