Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vcpkg_from_github] Not able to download private GitHub repo with vcpkg_from_github and VCPKG_USE_HEAD_VERSION #19078

Closed
srgbtl opened this issue Jul 22, 2021 · 1 comment · Fixed by #19077
Assignees
Labels
category:vcpkg-bug The issue is with the vcpkg system (including helper scripts in `scripts/cmake/`)

Comments

@srgbtl
Copy link
Contributor

srgbtl commented Jul 22, 2021

Describe the bug
In case VCPKG_USE_HEAD_VERSION is enabled and private GitHub repo is specified in vcpkg_from_github - downloading fails with the following error: "Failed. Status: 22;"HTTP response code said error""
During the investigation, it appears that AUTHORIZATION_TOKEN is not passed to the vcpkg_download_distfile() command which retrieves VCPKG_HEAD_VERSION.

Environment

  • OS: Windows
  • Compiler: msvc/clang

To Reproduce
Create a port file that uses private repo and enable VCPKG_USE_HEAD_VERSION:

set(VCPKG_USE_HEAD_VERSION enabled)

vcpkg_from_github(
    OUT_SOURCE_PATH SOURCE_PATH
    REPO private/repo
    HEAD_REF main
    AUTHORIZATION_TOKEN $ENV{AUTH_TOKEN}
)

Expected behavior
Repo is downloaded successfully and is ready to build process

Failure logs

-- Downloading https://api.github.com/repos/private/repo/git/refs/heads/main... Failed. Status: 22;"HTTP response code said error"
CMake Error at scripts/cmake/vcpkg_download_distfile.cmake:251 (message):

      

      Failed to download file.

      If you use a proxy, please check your proxy setting. Possible causes are:

      

      1. You are actually using an HTTP proxy, but setting HTTPS_PROXY variable

         to `https://address:port`. This is not correct, because `https://` prefix

         claims the proxy is an HTTPS proxy, while your proxy (v2ray, shadowsocksr

         , etc..) is an HTTP proxy. Try setting `http://address:port` to both

         HTTP_PROXY and HTTPS_PROXY instead.

      

      2. You are using Fiddler. Currently a bug (https://github.com/microsoft/vcpkg/issues/17752)

         will set HTTPS_PROXY to `https://fiddler_address:port` which lead to problem 1 above.

         Workaround is open Windows 10 Settings App, and search for Proxy Configuration page,

         Change `http=address:port;https=address:port` to `address`, and fill the port number.

      

      3. You proxy's remote server is out of service.

      

      In future vcpkg releases, if you are using Windows, you no longer need to set

      HTTP(S)_PROXY environment variables. Vcpkg will simply apply Windows IE Proxy

      Settings set by your proxy software. See (https://github.com/microsoft/vcpkg-tool/pull/49)

      and (https://github.com/microsoft/vcpkg-tool/pull/77)

      

      Otherwise, please submit an issue at https://github.com/Microsoft/vcpkg/issues



Call Stack (most recent call first):

  scripts/cmake/vcpkg_from_github.cmake:153 (vcpkg_download_distfile)

Proposed fix in #19077

@ras0219-msft
Copy link
Contributor

As a workaround, you can also try using vcpkg_from_git() and the auth suggestions from #17272

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:vcpkg-bug The issue is with the vcpkg system (including helper scripts in `scripts/cmake/`)
Projects
None yet
3 participants