vscode-gitlens icon indicating copy to clipboard operation
vscode-gitlens copied to clipboard

`gitlens.remotes` no longer takes effect when defined in project's `.vscode/settings.json` file

Open sjdemartini opened this issue 2 years ago • 11 comments

Description

  1. With GitLens version v2023.6.2005
  2. With a .vscode/settings.json file that defines the "gitlens.remotes" field, like:
    "gitlens.remotes": [
      {
        "domain": "my.custom.example.com",
        "type": "GitLab"
      }
    ],
    

Historically, this was sufficient (for the past couple years or so), and the remote would take effect for the whole project. Now, it seems I need to separately define this setting instead/externally in my own .code-workspace workspace settings file in order for it to take effect. (That's rather inconvenient for our shared project where all developers should benefit from the same remote setup.) With the definition above only in the .vscode/settings.json, all remote-associated commands like GitLens: Copy Remote File URL, GitLens: Copy Remote Commit URL, etc. do not work:

image

Separately, clicking that See how to configure a custom remote provider... link goes to https://github.com/gitkraken/vscode-gitlens#remote-provider-integration-settings-, which is dead (the anchor no longer exists). There is no help about how to resolve.

Other GitLens behavior still works fine (I can view inline blame, look at file details, etc.).

GitLens Version

v2023.6.2005

VS Code Version

Version: 1.79.2 Commit: 695af097c7bd098fbf017ce3ac85e09bbc5dda06 Date: 2023-06-14T08:58:52.392Z (1 wk ago) Electron: 22.5.7 Chromium: 108.0.5359.215 Node.js: 16.17.1 V8: 10.8.168.25-electron.0 OS: Darwin x64 22.5.0

Git Version

git version 2.30.0

Logs, Screenshots, Screen Captures, etc

For what it's worth, I do see a single line in the GitLens output:

[2023-06-21 18:50:41.427] [GIT  ] [/Users/sdemartini/vscode_workspaces] git rev-parse --show-toplevel • Command failed: /usr/local/bin/git -c core.quotepath=false -c color.ui=false rev-parse --show-toplevel • not a git repository (or any of the parent directories): .git [54ms]

I have my foo.code-workspace file in the /Users/sdemartini/vscode_workspaces directory, which is not where the actual repo is (the folders for the workspace point to a different path), but this seems likely to be unrelated.

sjdemartini avatar Jun 21 '23 19:06 sjdemartini

@sjdemartini @DanaGoyette We'll get that link update, thanks! The correct link is: https://help.gitkraken.com/gitlens/gitlens-settings/#remote-provider-integration-settings

d13 avatar Jun 22 '23 18:06 d13

Experiencing this same issue, correctly configured gitlens.remotes in both my workspace config file, project, and user config file, and still getting that no auto-detected or configured remote providers found warning when I try to view a file on the remote.

Worse part is Gitlens is working properly beyond that, since the Gitlens remote view looks and browses fine, and that the couple of bug reports I found via google from 2021 and 2022 were all closed when the issue still happens. Guessing since its June 2024, this might not ever be fixed?

sgarcia-dev avatar Jun 06 '24 16:06 sgarcia-dev

Same issue here, please fix it. Looked for a day through all the issues, I can't get it to work.

koenieee avatar Jun 19 '24 14:06 koenieee

Also came here to say I am experiencing this issue. went through several different attempts to get it to work. it was working before but now just stopped working.

ahammer-sc avatar Aug 01 '24 14:08 ahammer-sc

I was able to get this working. I ran $ git remote -vv to see what my git path was. Based on that, I set this code in my ~/Library/Application Support/Code/User/settings.json file:

    "gitlens.remotes": [
        {
            "regex": "git@(.+):(.+).git",
            "type": "GitHub",
        }
    ]

The captured snippets inside both (.+) combined to make my Github URL (i.e. "github.my-company.com/repo") so you may need to play around with the regex.

I did NOT need the additional "gitlens.integrations.enabled": true option.

lmao12 avatar Aug 01 '24 15:08 lmao12

Any updates here? Copy Remote File URL still didnt work with 'domain' setting

Actticus avatar Sep 04 '24 08:09 Actticus

This is working for me on GitLens v13.6.0 after following the examples in the docs. However, the instructions are missing a critical step: restart VSCode after adding the remote.

andrew-hardin avatar Nov 01 '24 17:11 andrew-hardin

"gitlens.remotes": [ { "regex": "git@(.+):(.+).git", "type": "GitHub", } ]

This worked for me. Thanks!

kshashank231 avatar Nov 13 '24 03:11 kshashank231

I was able to get this working. I ran $ git remote -vv to see what my git path was. Based on that, I set this code in my ~/Library/Application Support/Code/User/settings.json file:

    "gitlens.remotes": [
        {
            "regex": "git@(.+):(.+).git",
            "type": "GitHub",
        }
    ]

The captured snippets inside both (.+) combined to make my Github URL (i.e. "github.my-company.com/repo") so you may need to play around with the regex.

I did NOT need the additional "gitlens.integrations.enabled": true option.

It works for me, thank you very much!

WinjayYu avatar Apr 04 '25 07:04 WinjayYu

Thank you @lmao12 This also worked for "GitLab"!!

I tried the regex custom following the doc and I didn't managed to make work. It was always skipping the repoBase

I was able to get this working. I ran $ git remote -vv to see what my git path was. Based on that, I set this code in my ~/Library/Application Support/Code/User/settings.json file:

    "gitlens.remotes": [
        {
            "regex": "git@(.+):(.+).git",
            "type": "GitHub",
        }
    ]

The captured snippets inside both (.+) combined to make my Github URL (i.e. "github.my-company.com/repo") so you may need to play around with the regex.

I did NOT need the additional "gitlens.integrations.enabled": true option.

EwertonLuan avatar May 27 '25 10:05 EwertonLuan

@d13 when you removed the bug tag were you saying that you believe the original report (that setting gitlens.remotes in the project's .vscode folder does not work) is fixed?

Seems like the original bug report was hijacked, and the thing that's fixed is the secondary issue where the link to the documentation was in error.

Unless there's a non-obvious way to set the remotes for a project in the folder settings.json? Or is it actually by-design?

To clarify: I can set gitlens.remotes in the project workspace, close vscode, reopen vscode and the "open commit on remote" works. I can then cut the setting from the project workspace, paste the exact same setting into the .vscode settings.json file, close vscode, reopen vscode and "open commit on remote" fails with "no autodetected or configured remote providers found"

gwinkless avatar Jun 13 '25 09:06 gwinkless

Excuse me,

How can i fix it when my git website has a port number?

git cmd use 3022,bug website use 3000,like: origin ssh://git@xxx:3022/xx/xxxx.git but website is : http://xxx:3000/xx/xxxx

"regex": "git@(.+):3022/(.+).git" using this will make See how to configure a custom remote provider... disappear. But open link with out port number. what should i do ?

Utopia-Zzzz avatar Sep 28 '25 10:09 Utopia-Zzzz

If this issue is reproducible, can one of you please enable debug logging by running from GitLens: Enable Debug Logging from the Command Palette (F1 or ctrl/cmd+shift+p). This will enable logging to the GitLens and GitLens (Git) channel in the Output pane.

Once enabled, please reproduce the issue, and attach the log from both the GitLens and GitLens (Git) channels.

Thank you!

d13 avatar Oct 06 '25 15:10 d13

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!

github-actions[bot] avatar Oct 14 '25 05:10 github-actions[bot]

@gwinkless I've tried setting gitlens.remotes in both user/workspace settings and in a .vscode/settings.json in the folder and I'm seeing the remotes loaded in all cases.

Can you still reproduce this on the latest version? If so, can you provide exact steps and/or a reproducible sample? Thanks!

eamodio avatar Oct 20 '25 17:10 eamodio

@gwinkless I've tried setting gitlens.remotes in both user/workspace settings and in a .vscode/settings.json in the folder and I'm seeing the remotes loaded in all cases.

Can you still reproduce this on the latest version? If so, can you provide exact steps and/or a reproducible sample? Thanks!

@eamodio It's now picking up the settings from the project .vscode folder for me. I didn't change anything.

Not sure if the code changed or if this is a transient, if it starts happening again I'll grab the debug logs for it.

gwinkless avatar Oct 21 '25 08:10 gwinkless

@gwinkless Thanks! I'm going to close this then, but we can re-open if it becomes reproducible again.

eamodio avatar Oct 22 '25 05:10 eamodio

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Nov 21 '25 05:11 github-actions[bot]