Replies: 16 comments
-
I'm not sure; could you sanitize the portfile for repo_B and post it along with some more details of the situation? (For example, I don't understand why/how you're using git to access |
Beta Was this translation helpful? Give feedback.
-
@ras0219-msft The portfile is shown below,
|
Beta Was this translation helpful? Give feedback.
-
Ok, I got a "proof of concept" to work:
This allows me to download archives from private repos, however it certainly has huge problems (first of which, it will pass your PAT to all websites, not just GitHub). In general though, I think an interaction-less approach will be better than constantly requiring the user to enter their password. My thoughts are therefore to add it as an environment variable that you would set ( Would that work well for you? |
Beta Was this translation helpful? Give feedback.
-
but what about private repos on bitbucket/gitlab ? |
Beta Was this translation helpful? Give feedback.
-
@ras0219-msft I think it will be great to have both interaction and interaction-less. Interaction-less is great for CI purposes but at the same time there are situations where multiple people are accessing the same computer/server so storing github password through environment variables is not a good idea for those cases. In this case credential prompt would be more suitable. |
Beta Was this translation helpful? Give feedback.
-
In the shared computer case, the idea would be that you could set this environment variable just for the shell you're using: $env:VCPKG_GITHUB_USERPWD = "user:passwd"
vcpkg stuff Once the shell closes, your password is no longer stored :) Though, it wouldn't work very well while giving a presentation. @crackedmind You're definitely right that this only solves GitHub for now! I think a more general solution can be evolved out of this, but I want to make sure we solve @jasjuang's problem in the short term. Some possible evolutions would be:
A big problem with the general case is that every service can have completely different ways to expect authentication (Maybe they require OAuth tokens in the URL, maybe they use HTTP basic auth, maybe they want SSL client certs, etc). Therefore, we'll definitely need to collect lots of specific individual use cases! |
Beta Was this translation helpful? Give feedback.
-
@ras0219-msft Yes that makes sense, so I guess as long as the error message is |
Beta Was this translation helpful? Give feedback.
-
@ras0219-msft: Git already has a credential manager, I don't understand why it is necessesary to reinvent it. Can't we just use it? And I'm not sure how I feel about storing my password as plaintext. |
Beta Was this translation helpful? Give feedback.
-
Just in case anyone is interested. I figured out a hack that will make it work temporarily. I downloaded the release from github manually and place it in the downloads folder, so when I do |
Beta Was this translation helpful? Give feedback.
-
@ras0219-msft I'm hitting this as well but with |
Beta Was this translation helpful? Give feedback.
-
ITNOA I think a good documentation in wiki for this scenario is a very good choice and needed. |
Beta Was this translation helpful? Give feedback.
-
@jasjuang Your hack works for me as well, thanks. Have you tried Unfortunately, Anyway, if I modify that NOTE: I used 40 characters of an SHA for my purposes, like so (WARNING: potentially bad command invocation; see above):
|
Beta Was this translation helpful? Give feedback.
-
I also encountered this problem,seems no place to input my username and password, did you find any other solution? this problem stoped me to use vcpkg in my company projects. |
Beta Was this translation helpful? Give feedback.
-
It took me a while to figure this one out, even though the information is on the Internet (like always I guess) here. What we want to do is to "inject" our git credentials inside the script. Here's a TL;DR/particular implementation that I use on Jenkins:
#!/usr/bin/env bash
echo username=$GIT_USERNAME
echo password=$GIT_PASSWORD
withCredentials([usernamePassword(credentialsId: 'github',
usernameVariable: 'GIT_USERNAME',
passwordVariable: 'GIT_PASSWORD')])
{} e.g. withCredentials([usernamePassword(credentialsId: 'github',
usernameVariable: 'GIT_USERNAME',
passwordVariable: 'GIT_PASSWORD')])
{
sh "./scriptThatCallsGit.sh"
} Of course this can be adapted for Windows with e.g. a From what I understand, I'd argue that this approach solves the need raised by this issue. The approach also provides a clear separation of concern between authentication and content retrieval, which makes vcpkg's code easier to maintain. |
Beta Was this translation helpful? Give feedback.
-
For vcpkg_from_github, you can pass the token via 'AUTHORIZATION_TOKEN' to setup the private repo. See https://github.com/Microsoft/vcpkg/blob/master/scripts/cmake/vcpkg_from_github.cmake#L16 |
Beta Was this translation helpful? Give feedback.
-
See also the discussion #17272 for some solutions |
Beta Was this translation helpful? Give feedback.
-
I have a private repo A that is dependent on some external libraries and private repo B. Currently external libraries are installed in vcpkg and private repo B is installed in the default
C:/Program Files (x86)
. I attempted to write a portfile for private repo B, so everything will be fromvcpkg
but the problem is when I dovcpkg install repo_B
I am expecting a git credential prompt in the terminal, but instead I get the errorFailed. Status: 22;"HTTP response code said error"
Is it possible to not fail directly and prompt for git credentials instead?
Beta Was this translation helpful? Give feedback.
All reactions