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

Can't authenticate to private repositories via HTTPS #567

Open
danir-de opened this issue Sep 9, 2022 · 1 comment
Open

Can't authenticate to private repositories via HTTPS #567

danir-de opened this issue Sep 9, 2022 · 1 comment

Comments

@danir-de
Copy link

danir-de commented Sep 9, 2022

Describe the Bug

Trying to copy a repo via HTTPS where an authentication to the repository is required fails.
The error message:

Error: Execution of 'git clone --branch Preview https://xxxxxx/xxxxxxx/_git/xxx /var/www/' returned 128: Cloning into '/var/www/'...
fatal: could not read Username for 'https://xxxxxx': No such device or address

Expected Behavior

Define base_auth_(username|password) and git should be able to fetch the repository.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Try to load a git repository over an HTTPS, that is protected via user authentication.
  2. Provide both base_auth_(username|password).
  3. Get the error.

Environment

  • vcsrepo 5.2.0
  • Puppet 7.18.0
  • Debian 11
  • Azure Devops Server (in a git environment)

Additional Context

  • Similar to git http password not allowed  #97, but couldn't be resolved by providing a .netrc file to the user set via the "user" variable.
  • Providing username and password by adding them in the https://username:[email protected] syntax does not solve the issue.
@bugfood
Copy link

bugfood commented Oct 31, 2022

The basic_auth parameters are not implemented by the git provider within vcsrepo. Per README.me, only hg and svn are supported.

It's possible to specify credentials within an HTTP/HTTPS URL, e.g.:
https://username:[email protected]/repo.git

This works for vcsrepo within the source parameter.

Note that these credentials will then be stored within the configuration of that repo working copy, viewable by anyone with read access, and re-usable by any other git operations, external to vcsrepo, within that working copy. This could be desirable or undesirable, depending on your security requirements.

Another way could be to set credentials in the user's ~/.gitconfig file. I have not tested this.
https://git-scm.com/docs/gitcredentials

More comprehensive support would probably require vcsreport to support git's credential helper mechanism internally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants