Windows Copilot CLI 配置 Proxy
前提:
已安装Copilot CLI
已知使用Copilot CLI的官方文档地址: 使用Copilot CLI 不知道怎么安装可以看官网
全局配置文件路径如下,不支持设定代理
C:\Users\用户名\.copilot\config.json
所以需要在powershell中,设定如下环境变量
注意因为部分Proxy存在账密,所以需要设定,有一些不需要的就可以不设定
[Environment]::SetEnvironmentVariable("HTTPS_PROXY", "http://代理用户名:代理密码@ProxyIp:ProxyPort", "User")
[Environment]::SetEnvironmentVariable("HTTP_PROXY", "http://代理用户名:代理密码@ProxyIp:ProxyPort", "User")
[Environment]::SetEnvironmentVariable("NODE_TLS_REJECT_UNAUTHORIZED", "0", "User")
密码中存在特殊字符的,需要转义一下
| 字符 | 编码 |
|---|---|
@ |
%40 |
: |
%3A |
# |
%23 |
! |
%21 |
$ |
%24 |
& |
%26 |
\ |
%5C |
如何测试需要账密的Proxy是否有效,可以使用最简单的curl方式验证(cmd即可),
能拿到Github返回的所有可用的端点 URL 模板,就说明这个Proxy是有效的
curl.exe --proxy "代理协议类型://代理IP:代理端口" --proxy-user '用户名:密码' https://api.github.com -k
正常返回结果:
{
"current_user_url": "https://api.github.com/user",
"current_user_authorizations_html_url": "https://github.com/settings/connections/applications{/client_id}",
"authorizations_url": "https://api.github.com/authorizations",
"code_search_url": "https://api.github.com/search/code?q={query}{&page,per_page,sort,order}",
"commit_search_url": "https://api.github.com/search/commits?q={query}{&page,per_page,sort,order}",
"emails_url": "https://api.github.com/user/emails",
"emojis_url": "https://api.github.com/emojis",
"events_url": "https://api.github.com/events",
"feeds_url": "https://api.github.com/feeds",
"followers_url": "https://api.github.com/user/followers",
"following_url": "https://api.github.com/user/following{/target}",
"gists_url": "https://api.github.com/gists{/gist_id}",
"hub_url": "https://api.github.com/hub",
"issue_search_url": "https://api.github.com/search/issues?q={query}{&page,per_page,sort,order}",
"issues_url": "https://api.github.com/issues",
"keys_url": "https://api.github.com/user/keys",
"label_search_url": "https://api.github.com/search/labels?q={query}&repository_id={repository_id}{&page,per_page}",
"notifications_url": "https://api.github.com/notifications",
"organization_url": "https://api.github.com/orgs/{org}",
"organization_repositories_url": "https://api.github.com/orgs/{org}/repos{?type,page,per_page,sort}",
"organization_teams_url": "https://api.github.com/orgs/{org}/teams",
"public_gists_url": "https://api.github.com/gists/public",
"rate_limit_url": "https://api.github.com/rate_limit",
"repository_url": "https://api.github.com/repos/{owner}/{repo}",
"repository_search_url": "https://api.github.com/search/repositories?q={query}{&page,per_page,sort,order}",
"current_user_repositories_url": "https://api.github.com/user/repos{?type,page,per_page,sort}",
"starred_url": "https://api.github.com/user/starred{/owner}{/repo}",
"starred_gists_url": "https://api.github.com/gists/starred",
"topic_search_url": "https://api.github.com/search/topics?q={query}{&page,per_page}",
"user_url": "https://api.github.com/users/{user}",
"user_organizations_url": "https://api.github.com/user/orgs",
"user_repositories_url": "https://api.github.com/users/{user}/repos{?type,page,per_page,sort}",
"user_search_url": "https://api.github.com/search/users?q={query}{&page,per_page,sort,order}"
}
作者:人间春风意
扫描左侧的二维码可以赞赏

本作品采用署名-非商业性使用-禁止演绎 4.0 国际 进行许可。

浙公网安备 33010602011771号