Skip to content

Doesn't seem to work with https git remotes #41

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

Closed
andyjeffries opened this issue Mar 21, 2022 · 11 comments
Closed

Doesn't seem to work with https git remotes #41

andyjeffries opened this issue Mar 21, 2022 · 11 comments
Labels

Comments

@andyjeffries
Copy link

Settings.json:

{
  "gitlink.defaultRemote": "origin",
}

Git remote output:

origin  [email protected]:repo-owner/repo-name.git (fetch)
origin  [email protected]:repo-owner/repo-name.git (push)
staging https://git.heroku.com/repo-name-staging.git (fetch)
staging https://git.heroku.com/repo-name-staging.git (push)

When I try to do "Goto Online link I get":

Can't parse https://git.heroku.com/repo-name-staging.git with Default rules

I'm running v0.8.1

@qinezh
Copy link
Owner

qinezh commented Mar 24, 2022

@andyjeffries it looks like a self-host repo in heroku.com for the staging, which is not supported by now.

@andyjeffries
Copy link
Author

I don't understand what you mean? That's how people deploy to Heroku - by adding a git remote.

Also, given that my defaultRemote is set to origin why is it even caring about the Heroku remote?

@andyjeffries
Copy link
Author

So, sorry when I said "doesn't seem to work with https git remotes", I didn't mean that I couldn't use it - but that the entire plugin doesn't work if you have one, even if you explicitly set it not to use that remote but a regular GitHub remote.

@qinezh
Copy link
Owner

qinezh commented Mar 24, 2022

@andyjeffries It should work for GitHub no matter via ssh or https. I have just verified from my side, would you please double check?

$ git remote -v
https   https://github.com/qinezh/vscode-gitlink.git (fetch)
https   https://github.com/qinezh/vscode-gitlink.git (push)
origin  [email protected]:qinezh/vscode-gitlink (fetch)
origin  [email protected]:qinezh/vscode-gitlink (push)

@andyjeffries
Copy link
Author

OK, so I checked out your repo:

$ git clone [email protected]:qinezh/vscode-gitlink

Then I edited .git/config to contain:

[remote "https"]
	url = https://github.com/qinezh/vscode-gitlink.git
	fetch = +refs/heads/*:refs/remotes/origin/*
[remote "origin"]
	url = [email protected]:qinezh/vscode-gitlink
	fetch = +refs/heads/*:refs/remotes/origin/*

And it worked fine when I did "Copy online link".

Then I changed it to be:

[remote "https"]
	url = https://git.heroku.com/repo-name-staging.git
	fetch = +refs/heads/*:refs/remotes/origin/*
[remote "origin"]
	url = [email protected]:qinezh/vscode-gitlink
	fetch = +refs/heads/*:refs/remotes/origin/*

And it breaks. I then did:

$ mkdir .vscode
$ echo '{"gitlink.defaultRemote": "origin",}' > .vscode/settings.json

That should force it to ignore the "https" remote and use the "origin" one, right?

Same issue.

@andyjeffries
Copy link
Author

It looks like it doesn't like "https://HOSTNAME/repo.git" only "https://HOSTNAME/ACCOUNT/repo.git", without that folder it breaks.

However (and this is most important) with the setting for defaultRemote as documented set to a [email protected] remote, it shouldn't even be trying to look at or parse the https one, it should just completely ignore it.

@qinezh qinezh added the bug label Mar 24, 2022
@qinezh
Copy link
Owner

qinezh commented Mar 24, 2022

Yeah, that would be a good point. Marked it as bug. Thank you for reporting it.

@andyjeffries
Copy link
Author

No worries. Never looked at Typescript before, but I'm trying to have a look at raising a PR for git-urls. It may end up being ignored or implementing differently, but at least I'm not just saying "here's a bug, please fix it" but trying to help out at the same time :-)

@andyjeffries
Copy link
Author

qinezh/git-urls#28

@qinezh
Copy link
Owner

qinezh commented May 1, 2022

@andyjeffries this issue should be resolved in latest release 1.0.1, please take a try 😄

@andyjeffries
Copy link
Author

Yep, working perfectly for me now. Many thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants