Skip to content
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

fix: use ssh url for ssh protocol upstream #3853

Merged
merged 1 commit into from
Oct 5, 2022
Merged

fix: use ssh url for ssh protocol upstream #3853

merged 1 commit into from
Oct 5, 2022

Conversation

yin1999
Copy link
Contributor

@yin1999 yin1999 commented Aug 15, 2022

The git protocol is not supported by GitHub, see: https://github.blog/2021-09-01-improving-git-protocol-security-github/

When we use this extension in a repo which is using ssh protocol (such as: [email protected]:microsoft/vscode-pull-request-github), the upstream will be set as git://xxxxxx. But it's not supported on GitHub.

We should set ssh protocol instead.

Steps to reproduce

  1. Clone a fork to locale with ssh protocol git clone [email protected]:<user>/vscode-pull-request-github.git
  2. Open this fork folder in vs code with vscode-pull-request-github extension
  3. open file .git/config, we can see the upstream url is set to git://github.com/microsoft/vscode-pull-request-github.git (with git protocol which is not supported by GitHub now. And I think it should be ssh protocol which is the same as the fork's protocol)

@yin1999
Copy link
Contributor Author

yin1999 commented Oct 2, 2022

Is there any problem on this?

Copy link
Member

@alexr00 alexr00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR and for the reminder! the ssh_url still used the git protocol in my testing, but it still makes sense to switch over to it in case that changes.

I will merge this PR later this week after we have released the new version of the extension.

@alexr00 alexr00 added this to the October 2022 milestone Oct 3, 2022
@yin1999
Copy link
Contributor Author

yin1999 commented Oct 4, 2022

Thanks for the PR and for the reminder! the ssh_url still used the git protocol in my testing, but it still makes sense to switch over to it in case that changes.

Hi @alexr00, I'm not really sure about this, I've tested on my windows, and this works for me (if I just use my fix-ssh-url branch).

out.mp4

But, when I merge the newest main branch into this branch (git rebase main), the upstream will be set as git protocol:

out2.mp4

And I can't debug with the rebased branch, so I can't figure out what's wrong with this.

@alexr00
Copy link
Member

alexr00 commented Oct 4, 2022

@yin1999 I'm still seeing the git protocol in your first video:

image

@yin1999
Copy link
Contributor Author

yin1999 commented Oct 4, 2022

@yin1999 I'm still seeing the git protocol in your first video:

image

This is still ssh protocol, because we can omit ssh:// prefix:

image

@yin1999
Copy link
Contributor Author

yin1999 commented Oct 4, 2022

This is still ssh protocol, because we can omit ssh:// prefix:

See also: https://git-scm.com/book/en/v2/Git-Internals-Transfer-Protocols#_ssh_2

@alexr00
Copy link
Member

alexr00 commented Oct 4, 2022

Thanks for the explanation! I tested again with a rebase to bring in the latest changes, and I get the correct format:

[remote "upstream"]
	url = [email protected]:microsoft/vscode-pull-request-github.git
	fetch = +refs/heads/*:refs/remotes/upstream/*

I'm still planning to merge this right after the next release.

@alexr00 alexr00 merged commit 747f72d into microsoft:main Oct 5, 2022
@yin1999 yin1999 deleted the fix-ssh-url branch October 5, 2022 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants