"Link your site to a Git repository" shows only first 100 Gitlab repositories

When choosing a Gitlab repository to link in the “Link your site to a Git repository” page, I can only see the first 100 groups.

In the requests, I can see a request made with this URL:
GET https://gitlab.com/api/v4/groups?per_page=5000

This is incorrect, since the API has a maximum of 100, as per the Gitlab API docs:

I have access to 907 groups (I have maintainer access to all of them), so I only have a 11% chance of finding my group (and project!) in the first 100, and your app doesn’t any way to load more or search in them.

If I try to search “web” (part of the name of the repo I want), this request is made:
GET https://gitlab.com/api/v4/users/jdvivar/projects?min_access_level=40&page=1&per_page=25&search=web

min_access_level=40 means at least I’m owner, but this doesn’t throw repos in said groups, only the ones without a group.

This means I cannot search through the 907 repositories and you only show the first 100. This is not an issue to any user that has access to less than 100 groups, but it’s for me.

Is there a way to manually link the repository, but stating its name/id/etc., while you solve this bug?

Thank you!

I’m copying here some screenshots to show you the issue:

In this screenshot you can see only 3 projects (the projects where I was the original creator, owner)

In this screenshot you can see the request to groups endpoint with per_page=500 (it will only return 100), which returns all groups/repositories I’m maintainer:

In this screenshot you can see I can select any of the groups, the first one is called “upgrade-hub/FSD FT JUNIO 2021/ANGULAR”:

I could select that repository (because I’m its maitainer), but if I look for “JUNIO”, nothing returns:

Sorry for the replies, but the site’s engine only allows one media item per post :unamused:

Hi @jdvivar,

Thank you for the report. I’ll pass this on to the required team. As a workaround, you can create a new site via API or CLI. There you have an option to connect to a repo.

By the way, I think the easiest way to solve is not by improving the browsing or search features in place. But instead offering a way to input the project id manually. The browsing or search features that are implemented today are only to select a project, then there’s the actual process of linking it. I’d say adding the input would be more straightforward, however that’s up for your dev team to decide.

Hi @jdvivar,

That suggestion makes sense. But it’s also true that the percentage of users with 100+ repos specifically on GitLab might be less than the ones with less repos and thus, only a very small number of people have reported this yet.

Turns out, this issue was already filed and is being worked upon - so you’re not alone. But for the time being, I think you might have to work with API or CLI unfortunately.


Any update on the progress of this bug?

Also, AFAIK the CLI doesn’t allow linking remote repos, only local ones. It would be nice to have that feature implemented in the CLI. Using the API (which the CLI can do), then there’s this tedious process documented here:

This message is to help others landing here for the same issue.

Hey there, @jdvivar :wave:

Thanks for checking in! Unfortunately, we do not have an update for you at this time. That being said, we will follow on up this thread when we do!

To this day, not solved: not in the CLI, not in the UI. :frowning:

(Replying here because a bot, SavvyBot, asked me to)

I’m surprised that 1.5 years later, this is still unsolved, and I’m a paying customer now. It’s so easy to resolve, it’s literally max 3 story points of one dev only, probably done in the span of 2-3 hours max.

At least try to refine it in a sprint, please! I already gave lots of information and how to solve it with Gitlab’s simple API.

I checked and now it is possible to do it all from the CLI (I’m quite sure it was not possible before). If someone comes here looking for a solution with the same problem with the same problem, you need to use link and then init commands from Netlify CLI: https://cli.netlify.com/