API calls fail when the GitLab instance is on a custom path, but the git remote isn't

Summary

The API calls are not working when the gitlab.instanceUrl setting contains a custom path, but the git remote URL doesn't.

Example:

"gitlab.instanceUrl": "http://aom-int/gitlab",

and git remote:

git@aom-int:depoortere/testmaven.git

The parsing logic expects that if the instanceUrl contains a custom path, the git remote will too. From the example above: http://aom-int/gitlab instanceUrl should have git@aom-int:gitlab/depoortere/testmaven.git git remote.

Details

The original issue with GitLab on a custom path is this: #42 (closed)

And the initial fix was implemented in !11 (merged).

The implementation assumes that if your GitLab instance is on a custom path (e.g. /gitlab) then the git remote URL contains the same path (i.e. in above scenario the remote should be git@aom-int:gitlab/depoortere/testmaven.git. I'm not sure whether that's a reasonable assumption or not, but it doesn't hold true in above scenario.

A workaround might be to use https:// remote URL instead of the git@... I assume that the https:// version would have /gitlab in the remote path.

The code for parsing remotes is in git_remote_parser.ts. I'm open to suggestions about how to change it. I also include a failing test with above scenario:

Failing test case
diff --git a/src/git/git_remote_parser.test.ts b/src/git/git_remote_parser.test.ts
index 33cba5a..c3c4586 100644
--- a/src/git/git_remote_parser.test.ts
+++ b/src/git/git_remote_parser.test.ts
@@ -81,4 +81,14 @@ describe('git_remote_parser', () => {
       project: 'gitlab-vscode-extension',
     });
   });
+
+  it('should support host aliases with a custom path', () => {
+    expect(
+      parseGitRemote('git@aom-int:depoortere/testmaven.git', 'https://aom-int/gitlab'),
+    ).toEqual({
+      host: 'aom-int',
+      namespace: 'depoortere',
+      project: 'testmaven',
+    });
+  });
 });
Original issue description

Say my GITLAB instance URL is https://xyz.com/gitlab (Exposed via Nginx)

In this case, the parsing by the extension is done incorrectly and fails to retrieve any information.

The parsed array gives this (removing /gitlab from the path):

["http:", "xyz.com", "my-group/subgroup1", "project"]

And thus the extension does not work. I tried concatenating the extra "/gitlab" and still it does not work.

Meanwhile, what ports does this extension need/use? I only have https port of my instance exposed - have not exposed the SSH or git port.

Edited by Tomas Vik (OOO back on 2026-04-07)