Skip to content

Conversation

@roveo
Copy link
Contributor

@roveo roveo commented Dec 5, 2025

PR Description

Use case: some repositories are cloned with a full SSH alias (without a user). E.g. in .ssh/config you have

Host gitlab
    HostName gitlab.com
    User git
    IdentityFile ...

and then you clone with git clone gitlab:foo/bar

According to the docs, you can add a service to config.yaml and it should work:

services:
  gitlab: 'gitlab:gitlab.com'

But currently it doesn't because lazygit expects all remote URLs to have a user. This can be fixed by the user by changing the URL to e.g. git@gitlab:foo/bar, but it breaks the user flow and is quite unexpected.

This PR changes defaultUrlRegexStrings and makes the user@ part of the remote URL optional. Fixes the issue for Github and Gitlab which use the default regexes.

Please check if the PR fulfills these requirements

  • [*] Cheatsheets are up-to-date (run go generate ./...)
  • [*] Code has been formatted (see here)
  • [*] Tests have been added/updated (see here for the integration test guide)
  • [*] Text is internationalised (see here)
  • [*] If a new UserConfig entry was added, make sure it can be hot-reloaded (see here)
  • [*] Docs have been updated if necessary
  • [*] You've read through your own file changes for silly mistakes etc

@roveo
Copy link
Contributor Author

roveo commented Dec 5, 2025

I think this fixes #5069

@stefanhaller stefanhaller added the bug Something isn't working label Dec 6, 2025
@stefanhaller
Copy link
Collaborator

Thanks, this looks good to me. (I'm not very familiar with this area of the code and functionality, so I hope I'm not missing something...)

I took the liberty of squashing your second commit into the first, I didn't see a reason why it should be a separate commit.

Also, next time please create a branch in your fork instead of using your master branch; this makes it slightly easier for me to work with it.

@stefanhaller stefanhaller merged commit cc96d8c into jesseduffield:master Dec 6, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants