-
Notifications
You must be signed in to change notification settings - Fork 16.4k
add user_name to http git #51256
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
add user_name to http git #51256
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,7 +48,7 @@ def get_ui_field_behaviour(cls) -> dict[str, Any]: | |
| return { | ||
| "hidden_fields": ["schema"], | ||
| "relabeling": { | ||
| "login": "Username", | ||
| "login": "Username or Access Token name", | ||
| "host": "Repository URL", | ||
| "password": "Access Token (optional)", | ||
| }, | ||
|
|
@@ -68,6 +68,7 @@ def __init__( | |
| super().__init__() | ||
| connection = self.get_connection(git_conn_id) | ||
| self.repo_url = repo_url or connection.host | ||
| self.user_name = connection.login or "user" | ||
| self.auth_token = connection.password | ||
| self.private_key = connection.extra_dejson.get("private_key") | ||
| self.key_file = connection.extra_dejson.get("key_file") | ||
|
|
@@ -89,7 +90,7 @@ def _process_git_auth_url(self): | |
| if not isinstance(self.repo_url, str): | ||
| return | ||
| if self.auth_token and self.repo_url.startswith("https://"): | ||
| self.repo_url = self.repo_url.replace("https://", f"https://{self.auth_token}@") | ||
| self.repo_url = self.repo_url.replace("https://", f"https://{self.user_name}:{self.auth_token}@") | ||
potiuk marked this conversation as resolved.
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what if user is not specified, and you don't want it to be specified?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The original one does not work for gitlab. So I was thinking specifying it like this will achieve the most compatibility. Please refer to: #51256 (comment) |
||
| elif not self.repo_url.startswith("git@") or not self.repo_url.startswith("https://"): | ||
| self.repo_url = os.path.expanduser(self.repo_url) | ||
|
|
||
|
|
||
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.
@codenamelxl it definitely seems wrong to have a default of "user" for username
why does that make sense?
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.
This is for the later logic which always enforces a "user_name".