GitLab: User owned projects report


Export a CSV formatted report of projects in user-namespace on a GitLab instance.

This is especially useful if you think about limiting or disabling this feature.

import gitlab

GITLAB_URL = ""
GITLAB_TOKEN = ""
CSV_SEP = ","

gl = gitlab.Gitlab(url=GIT_URL, private_token=GITLAB_TOKEN)

# Get all users
users = gl.users.list(iterator=True)

# Output results loosely as "csv" to stdout
print("username", "project", "url", sep=CSV_SEP)
for user in users:
    projects = user.projects.list(owned=True, iterator=True)
    for project in projects:
        print(user.name, project.name, project.web_url, sep=CSV_SEP)

See also