-
I've seen examples of how to add a git repo as dependency
and I've seen many different ways of providing credentials for private pypi repositories. But I'm still yet to understand how to provide credentials for a private git repository. I think I can add username and token via:
but I don't want to store the token in pyproject.toml It's also unclear if I could use an environment variable, or setup keyring somehow. Does anybody know either way what is possible? |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 18 replies
-
As a workaround for a build pipeline I'm currently using poetry remove myrepo in the build script, where TOKEN is a secret environment variable, so that presumably the value of TOKEN gets hardcoded into the pyproject file, but since the pyproject file is temporary, it's not such of an issue. |
Beta Was this translation helpful? Give feedback.
-
+1 to this question |
Beta Was this translation helpful? Give feedback.
-
I use SSH for Git authentication. So, my SSH keys are automatically used for poetry dependencies specified like This makes local development on poetry projects with private GitHub repo dependencies easy. However, I had issues setting up CI with GitHub Actions. I settled on configuring git to replace
I don't know if I'd recommend this for local development as it would mean your PAT is sitting unsecured in your git config file. (Whereas for GHA it's thrown away after the CI run. The PAT would be stored as a Secret that is accessed via It took me a while to figure out exactly how to do this in GitHub Actions (there are good docs for doing it with GitLab CI), so I wanted to post my solution here after finding this question during my search. |
Beta Was this translation helpful? Give feedback.
-
Well, I also use ssh but unfortunately I have multiple accounts with different ssh keys.
|
Beta Was this translation helpful? Give feedback.
-
I recently came up with a |
Beta Was this translation helpful? Give feedback.
-
I am having facing a issue w.r.t organization wide fine grained tokens. |
Beta Was this translation helpful? Give feedback.
-
If you are using Bitbucket, you can grant access to a repository using Repository Access Tokens. What's great about them is that you can set permissions very granularly - also "read only". You can revoke these tokens anytime.
and then you can simply include it in
|
Beta Was this translation helpful? Give feedback.
If you are using Bitbucket, you can grant access to a repository using Repository Access Tokens. What's great about them is that you can set permissions very granularly - also "read only". You can revoke these tokens anytime.
To use them (assuming your git repository that you want to include as a dependency is called
myproject
), run these in CI/command line:and then you can simply include it in
pyproject.toml
: