Configured remotes not showing up in quickpick menu when opening commit on remote
I set the output level to debug, but it doesn't output anything.
- GitLens Version: 2021.3.1104
- Git Version: 2.28.0
- VSCode Version: 1.54.3
- OS Version: macOS 11.2.3
Steps to Reproduce:
- set gitlens.integrations.enabled to true
- Based on https://github.com/eamodio/vscode-gitlens#remote-provider-integration-settings- add this to settings "gitlens.remotes": [{ "domain": "code.company.com", "type": "Custom", "name": "company", "protocol": "https", "urls": { "repository": "https://code.company.com/packages/${repo}", "branches": "https://code.company.com/packages/${repo}/repo-info", "branch": "https://code.company.com/packages/${repo}/trees/heads/${branch}", "commit": "https://code.company.com/packages/${repo}/commits/${id}", "file": "https://code.company.com/packages/${repo}?path=${file}${line}", "fileInBranch": "https://code.company.com/packages/${repo}/blobs/${branch}/--/${file}${line}", "fileInCommit": "https://code.company.com/packages/${repo}/blobs/${id}/--/${file}${line}", "fileLine": "#L${line}", "fileRange": "#L${start}-L${end}" } }],
- Save
- Restart VS Code
- Go to COMMITS tab in source controll.
- Click 'Open Commit on Remote' next to a commit
Expected: opens commit on the configured remote. Actual: 'No auto-detected or configured remote providers found' shows up in quickpick menu as if nothing was ever configured
Yup, experiencing this.
Can either of you post what the output of git remote -vv returns? Because the domain of the custom remote definition has to match the domain of your Git remote.
Certainly, it's different. But the purpose with Custom remote should enable us to add any domain, I believe we should treat this as a bug.
So the domain and git remote -vv are different, but I was under the impression that this would still allow us to open a webpage in the browser using this template: https://code.company.com/packages/${repo}/commits/${id} with the repo and id fillied in from that corresponding commit.
The gitlens.remotes property allows you to configure custom remote "matchers", so GitLens can use those configured custom remotes in addition to its built-in remote support for GitHub, Bitbucket, etc, to match against your repository remotes. If a match is found, then the urls configuration is used to open resources. So the domain property or the newly added regex property must be specified to perform that match.
Ah I see. That makes sense. I ran into another issue. So git remote -vv shows this
backup ssh://git.company.com:2222/pkg/RepoName/backup/username (fetch)
backup ssh://git.company.com:2222/pkg/RepoName/backup/username (push)
origin ssh://git.company.com:2222/pkg/RepoName (fetch)
origin ssh://git.company.com:2222/pkg/RepoName (push)
share ssh://git.company.com:2222/pkg/RepoName/share/username (fetch)
I have changed the domain to be git.company.com. However now ${repo} in the URL resolves to pkg/RepoName(https://code.company.com/packages/pkg/RepoName) instead of just RepoName (https://code.company.com/packages/RepoName).
So for that you'll need to use the regex property instead of domain and the first capture group is the domain part and the 2nd capture group is the repo
This issue needs more information and has not had recent activity. Please provide the missing information or it will be closed in 7 days. Thanks!
So for that you'll need to use the
regexproperty instead ofdomainand the first capture group is the domain part and the 2nd capture group is the repo
@eamodio I am facing the same issue here. Could you please provide an example? I couldn't find it in the README.md document. Thanks!
For this domain
origin ssh://git.company.com:2222/pkg/RepoName (fetch)
I tried
"regex": "ssh:\\/\\/(git.company.com):2222\\/pkg\\/(\\w+)"
"regex": "(ssh:\\/\\/git.company.com:2222)\\/pkg\\/(\\w+)"
"regex": "ssh:\/\/(git.company.com):2222\/pkg\/(\\w+)"
"regex": "(ssh:\/\/git.company.com:2222)\/pkg\/(\\w+)"
and none of them work. Could you please add documentation in the README.md on how use the regex property with some examples.
This issue needs more information and has not had recent activity. Please provide the missing information or it will be closed in 7 days. Thanks!
I have the original problem (No auto-detected or configured remote providers found). I have several equivalent remotes defined (for configuration reasons), and my employer has a custom protocol (sso), could either of those cause the problem?
$ git remote -vv
origin sso://our-domain/repo-name (fetch)
origin sso://our-domain/repo-name (push)
origin-3.2.0-hotfixes sso://our-domain/repo-name (fetch)
origin-3.2.0-hotfixes sso://our-domain/repo-name (push)
origin-v3.0.0 sso://our-domain/repo-name (fetch)
origin-v3.0.0 sso://our-domain/repo-name (push)
...
settings.json:
"gitlens.integrations.enabled": true,
"gitlens.remotes": [{
"domain": "our-domain",
"type": "Custom",
"name": "Company Name",
"protocol": "sso",
"urls": {
"repository": "...",
"branches": "...",
"branch": "...",
"commit": "...",
"file": "...",
"fileInBranch": "...",
"fileInCommit": "...",
"fileLine": "...",
"fileRange": "..."
}
}]
This issue needs more information and has not had recent activity. Please provide the missing information or it will be closed in 7 days. Thanks!
Is there some more information I can provide? I don't want this issue to be closed – it still affects me.
This also affects me, It used to work before but doesn't anymore, what information do you need?
FYI I tried removing my other remotes, so there's only one:
$ git remote -vv
origin sso://our-domain/repo-name (fetch)
origin sso://our-domain/repo-name (push)
$
I've tried setting gitlens.integrations.enabled and gitlens.remotes in my user settings and/or workspace settings (first one, then both, then only the other). I quit and restart VSCode. I still get "No auto-detected or configured remote providers found" :-(
Also, I typically ssh into a remote server to work (through VSCode's Remote - SSH extension), but I tried working out of a local folder and had the same problem.
Bump. Having the same issue here trying to use Bitbucket with GitLens. :-(
Sorry for the delay and confusion around this issue. I think I've gotten to the bottom of it, and I added 2 new examples in the README that use the regex property.
Can you please verify this fix in tomorrow's GitLens insiders edition?
You can install the GitLens insiders edition from here. Be sure to disable/uninstall the stable version of GitLens first.
Hey thank you so much for the fix!
It works for me. However, I got an Invalid escape character in string error when using what you had in the README example:
"ssh:\/\/(my\.company\.com):1234\/git\/(.+)"
This is because \. is not a valid escape character in JSON. This caused me to dig deeper into what is actually required.
To make it work, you could replace \. with just .
"ssh:\/\/(my.company.com):1234\/git\/(.+)"
which works, but it could match other incorrect strings as well because of the wild card.
A better fix would be to properly escape the \ by replacing \. with \\.
"ssh:\/\/(my\\.company\\.com):1234\/git\/(.+)"
I also found out that in JSON, you can, but are not required to escape /. \/ is just as valid as /. Allowing \/ helps when embedding JSON in a <script> tag, which doesn't allow </ inside strings. So this means that the example in the README could be simplified to only escape the . with two \ and leaving everything else alone.
"ssh://(my\\.company\\.com):1234/git/(.+)"
Thanks, I've fixed the example.