python-poetry / python-poetry/poetry

Certificates configuration to install packages with git+https from a company-hosted github/gitlab

Open
#9,717 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/docs status/triage
Dominant language
Python
Stars
34.3k
Forks
2.5k
Avg merge
2d 19h
Merged PRs (30d)
30

Description

Issue Kind

Improving documentation

Existing Link

https://python-poetry.org/docs/configuration/#certificatesnamecert

Description

I struggled several time trying to install python packages from git repository hosted on private company github or gitlab servers.

Specifically, with pip I can simply install a self-hosted gitlab repo with:

pip install git+https://mycompany.gitlab.com/org/myrepo.git

And to avoid SSL errors in the HTTPS connection, in the worst case I would just have to set the correct certificates bundle with:

export REQUESTS_CA_BUNDLE=/usr/local/share/ca-certificates/mycompany_root_cert.crt
pip install git+https://mycompany.gitlab.com/org/myrepo.git

Sadly this does not work with poetry, because by default is relying on system git to pull the repo (not on a python tool based on requests library).

This is very subtle and the documentation is not clear, and cannot find anything mentioning this in the documentation related to configuration of certificates or repository certificates

The only way I found to fix this is setting the correct certificate to the global git configuration with the following before using poetry:

git config --global http.sslCAInfo /usr/local/share/ca-certificates/mycompany_root_cert.crt
poetry add git+https://mycompany.gitlab.com/org/myrepo.git

This is very similar to #2475 and related issues, with the difference that the github/gitlab is a company one (so using different certificate), moreover #5428 + setting REQUESTS_CA_BUNDLE is still a possible solution, i.e.:

poetry config experimental.system-git-client true
export REQUESTS_CA_BUNDLE=/usr/local/share/ca-certificates/mycompany_root_cert.crt
poetry add git+https://mycompany.gitlab.com/org/myrepo.git

I think at least one of the two solution should be added to the documentation.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the certificates configuration and repository certificates pages linked in the issue, then compare the system Git and experimental system-git-client approaches described there. Document at least one supported certificate setup for private GitHub or GitLab dependencies, including the relevant commands and environment variables. Done means the documentation explains how to avoid the reported HTTPS certificate errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, github, gitlab, python
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.