Question, is this expected to work with gitolite or not ?
My company uses a self-hosted gitlab using gitolite, I face the following error while running the plugin.
gitlab.nvim: Failure initializing plugin: invalid git URL format: [email protected]:gt/core/algo-services-core.git which I found comes from https://github.com/harrisoncramer/gitlab.nvim/blob/e29909cd1064a7b53c3150bff49449a548dadf8d/cmd/app/git/git.go#L65
version 3.4.0 tag v3.4.0 branch main commit e29909c
(base) ➜ algo-services-core git:(release/ASVC-80/new_context) ✗ echo $GITLAB_URL
https://gitlab.p.ghpr.asia/
(base) ➜ algo-services-core git:(release/ASVC-80/new_context) ✗ git remote get-url origin
[email protected]:gt/core/algo-services-core.git
I don't any configuration can bypass this setting if I am reading the go code correctly, is there a solution for this ?
You can try creating a hotfix by adding gitolite to the regex on this line:
diff --git a/cmd/app/git/git.go b/cmd/app/git/git.go
index 1fcc708..f743fe9 100644
--- a/cmd/app/git/git.go
+++ b/cmd/app/git/git.go
@@ -59,7 +59,7 @@ func NewGitData(remote string, gitlabUrl string, g GitManager) (GitData, error)
https://[email protected]/namespace/subnamespace/dummy-test-repo.git
git@[email protected]:namespace/subnamespace/dummy-test-repo.git
*/
- re := regexp.MustCompile(`^(?:git@[^\/:]*|https?:\/\/[^\/]+|ssh:\/\/[^\/:]+)(?::\d+)?[\/:](.*)\/([^\/]+?)(?:\.git)?\/?$`)
+ re := regexp.MustCompile(`^(?:git@[^\/:]*|gitolite@[^\/:]*|https?:\/\/[^\/]+|ssh:\/\/[^\/:]+)(?::\d+)?[\/:](.*)\/([^\/]+?)(?:\.git)?\/?$`)
matches := re.FindStringSubmatch(url)
if len(matches) != 3 {
return GitData{}, fmt.Errorf("invalid git URL format: %s", url)
Thanks @jakubbortlik . Let me try that, assume it should work if the interfaces are the same.
@kanirudh have you tried the suggested solution? If it works, you can create a PR and hopefully it will be merged in.
Would it be possible to extract the ssh user from the remote url? We have a self hosted gitlab instance and the administrator changed the underlying user from git to gitlab.
So in our case the url would look like this:
[email protected]:namespace/subnamespace/dummy-test-repo.git
And I think it would be a pita to add every possible user name into the regex. I know it is best practice to just use the username git, but you can't rely on that, as you can see with the example of gitolite.
One thing in NewGitData() in line 60 you state, that the format should match this example:
git@[email protected]:namespace/subnamespace/dummy-test-repo.git
Are you shure about the doubled git@?
Thanks for you great work, I really appreciate it and use it on daily basis!