Search code examples
pythongitlabclonepython-gitlab

Clone a group of repos from GitLab via script


I'm trying to clone a group of my projects from Gitlab through a script. I found a python library that helps to connect to the Gitlab API. But it does not work.

gl = gitlab.Gitlab('https://gitlab.com/*myname*', private_token = '*mytoken*')
gl.auth()
grouplist = gl.groups.list()

The error is:

JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

The error seems to appear at the fetching of the gl object (first line of presented code)

The library is called python-gitlab (usable with import gitlab)

https://python-gitlab.readthedocs.io/en/stable/api-usage.html


Solution

  • Ok, so I finally found the issue. As base url, you do NOT need the gitlab url with your name, but only 'http://10.0.0.1'

    The issue is solved.