-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Add docs on replacing SSH repository URLs with HTTPS URLs #10435
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
base: main
Are you sure you want to change the base?
Conversation
Reviewer's GuideThis PR updates the dependency-specification guide by adding a new “Credentials for SSH repositories" section that shows how to configure Git’s insteadOf rule to swap SSH URLs for HTTPS URLs with embedded CI tokens, and includes a note (with tabbed examples) highlighting the URL mismatch pitfall between pyproject.toml and poetry.lock. Flow diagram for replacing SSH URLs with HTTPS URLs using Git insteadOfflowchart TD
A[Dependency in pyproject.toml uses SSH URL] --> B[User configures git insteadOf rule to map SSH URL to HTTPS URL with CI token]
B --> C[User runs 'poetry lock']
C --> D[poetry.lock contains SSH URL format]
D --> E[Git uses insteadOf rule to access repository via HTTPS with CI token]
E --> F[Dependency is installed without SSH keys]
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @whyscream - I've reviewed your changes - here's some feedback:
- Consider noting that users can scope the URL replacement to the current repository by using git config --local instead of --global.
- It might be helpful to warn about the security risk of embedding credentials in plaintext within the git config and suggest alternatives like environment variables or .netrc.
- Clarify that the insteadOf URL must match the exact URL format (including ssh:// vs shorthand [email protected]:owner/repo.git) as it appears in the poetry.lock file.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider noting that users can scope the URL replacement to the current repository by using git config --local instead of --global.
- It might be helpful to warn about the security risk of embedding credentials in plaintext within the git config and suggest alternatives like environment variables or .netrc.
- Clarify that the insteadOf URL must match the exact URL format (including ssh:// vs shorthand [email protected]:owner/repo.git) as it appears in the poetry.lock file.
## Individual Comments
### Comment 1
<location> `docs/dependency-specification.md:409` </location>
<code_context>
+This will replace the SSH URL with the HTTPS URL that includes the credentials, allowing Poetry to access the repository without needing SSH keys.
+
+{{% note %}}
+Be aware that there is a difference between the URL used in the `pyproject.toml` file and the URL in the `poetry.lock` file. For example, if you have a dependency in you pyproject.toml file like this:
+
+{{< tabs tabTotal="2" tabID1="git-ssh-credentials-project" tabID2="git-ssh-credentials-poetry" tabName1="[project]" tabName2="[tool.poetry]">}}
</code_context>
<issue_to_address>
Typo: 'you pyproject.toml file' should be 'your pyproject.toml file'.
Please change 'you pyproject.toml file' to 'your pyproject.toml file'.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
Be aware that there is a difference between the URL used in the `pyproject.toml` file and the URL in the `poetry.lock` file. For example, if you have a dependency in you pyproject.toml file like this:
=======
Be aware that there is a difference between the URL used in the `pyproject.toml` file and the URL in the `poetry.lock` file. For example, if you have a dependency in your pyproject.toml file like this:
>>>>>>> REPLACE
</suggested_fix>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This documents: - How to configure the (fallback) git client to use an alternative URL for a git repo listed in `pyproject.toml` or `poetry.lock` - How to set up credentials for such a URL - A common pitfall when configuring all this
64745cf to
520de02
Compare
This PR documents a clean solution for the configuration issue stated in #10167.
This documents:
pyproject.tomlorpoetry.lockResolves: #10167
Summary by Sourcery
Document how to configure Git to replace SSH repository URLs with HTTPS URLs that include credentials and clarify matching URLs between pyproject.toml and poetry.lock
Documentation: