Change Clone URL: Remove postfixed .git

Is it possible to configure GitLab to not postfix .git for the git clone URL?

git clone git@gitlab.company.com:group/project
Instead of
git clone git@gitlab.company.com:group/project.git

It should only be used .git postfix when cloning with --bare or --mirror.
Is there any way to configure this? This works with Gitolite.

Hi,

I just checked mine, as I know sometimes I’ve usually seen the .git showing up. Although now when I’ve just checked for example a project and it’s .git/config file there is no .git at the end of the URL. I did clone just like you did, albeit using https instead of ssh, so: git clone https://gitlab.mydomain.com/projectgroup/project and didn’t write .git at the end of it.

Not sure if I’m missing something from your question, as far as I can see it’s possible to clone without physically writing .git, and I don’t remember setting anything for this. I know that when I do a git pull it says “redirecting to” and shows the url with .git at the end of it. Even with my repo on gitlab.com it still shows the redirecting to.

1 Like

You are right. Git Clone works without specifying the .git at the end of the URL.
However I would like GitLab not to have this a suggestion in the UI for git clone operations.
Specially when it is not necessary for the git clone.

Clone URL in GitLab is shown with postfixed .git, the same also for the empty project page git instructions.

When I use the following git clone URL:
git clone git@gitlab.company.com:group/project.git
Then the .git/config has the URL
git@gitlab.company.com:group/project.git
And not git@gitlab.company.com:group/project

When I use the following git clone URL:
git clone git@gitlab.company.com:group/project
Then the .git/config has the URL
git@gitlab.company.com:group/project

It would make it much easier for us to migrate from Gitolite
Gitolite: git clone git@git.company.com:group/project
GitLab: git clone git@gitlab.company.com:group/project
All our developers need to do is change the hostname.

I cannot find an option for it, either in gitlab.rb or in admin panel. I think Gitlab have it by design to work like this without being able to configure, although I could be wrong. Not sure if it will require an issue to be opened so that perhaps Gitlab can add it, or make it easier to find/configure to enable or disable adding “.git” to the url by default.