One of my projects is using Poetry and has a private GitHub repository as a dependency. When I try to run poetry install
it fails due to the URL being HTTPS.
How do I configure a personal access token so that my Poetry is able to access this resource?
I've tried adding the GITHUB_TOKEN
environment variable and also using the Git Credential Manager but neither seem to work. The latter is oddly hanging whenever I call git credential approve
.
I needed to manually trigger the username-password prompt.
I'm not 100% sure how Poetry works, but I'm assuming that since it uses Git under the hood it doesn't provide any interactive prompts, and hence even though I was using a PAT as a, for example, environment variable Poetry wasn't able to access this.
After running git config --global credential.helper store
I had to do a "dummy clone" so that I'm prompted for my username and password. After providing my username and PAT Git stores it and Poetry is able to proceed as usual because it assumes that credential-related issues are already set up.