gitlab-group-clone icon indicating copy to clipboard operation
gitlab-group-clone copied to clipboard

Cloning of a group fails with MissingSchema error

Open miguelaferreira opened this issue 4 years ago • 4 comments

Fresh installation of gitlab-clone:

pip install --user gitlab-clone 
Collecting gitlab-clone
  Downloading gitlab_clone-1.1.0-py2.py3-none-any.whl (4.4 kB)
Requirement already satisfied: requests in /Users/miguel/Library/Python/3.9/lib/python/site-packages (from gitlab-clone) (2.25.1)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /Users/miguel/Library/Python/3.9/lib/python/site-packages (from requests->gitlab-clone) (1.26.3)
Requirement already satisfied: certifi>=2017.4.17 in /Users/miguel/Library/Python/3.9/lib/python/site-packages (from requests->gitlab-clone) (2020.12.5)
Requirement already satisfied: idna<3,>=2.5 in /Users/miguel/Library/Python/3.9/lib/python/site-packages (from requests->gitlab-clone) (2.10)
Requirement already satisfied: chardet<5,>=3.0.2 in /Users/miguel/Library/Python/3.9/lib/python/site-packages (from requests->gitlab-clone) (4.0.0)
Installing collected packages: gitlab-clone
Successfully installed gitlab-clone-1.1.0

Then trying to clone a group from gitlab.com produces this error:

gitlab-clone --group=123 --token=ABC --gitlab-url gitlab.com
Traceback (most recent call last):
  File "/Users/miguel/Library/Python/3.9/bin/gitlab-clone", line 8, in <module>
    sys.exit(main())
  File "/Users/miguel/Library/Python/3.9/lib/python/site-packages/gitlab_clone/clonner.py", line 24, in main
    clone(**request_param)
  File "/Users/miguel/Library/Python/3.9/lib/python/site-packages/gitlab_clone/clonner.py", line 32, in clone
    response = requests.get(
  File "/Users/miguel/Library/Python/3.9/lib/python/site-packages/requests/api.py", line 76, in get
    return request('get', url, params=params, **kwargs)
  File "/Users/miguel/Library/Python/3.9/lib/python/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/Users/miguel/Library/Python/3.9/lib/python/site-packages/requests/sessions.py", line 528, in request
    prep = self.prepare_request(req)
  File "/Users/miguel/Library/Python/3.9/lib/python/site-packages/requests/sessions.py", line 456, in prepare_request
    p.prepare(
  File "/Users/miguel/Library/Python/3.9/lib/python/site-packages/requests/models.py", line 316, in prepare
    self.prepare_url(url, params)
  File "/Users/miguel/Library/Python/3.9/lib/python/site-packages/requests/models.py", line 390, in prepare_url
    raise MissingSchema(error)
requests.exceptions.MissingSchema: Invalid URL 'gitlab.com/api/v4/groups/123/projects?private_token=ABC&include_subgroups=True&per_page=100&page=1&with_shared=False': No schema supplied. Perhaps you meant http://gitlab.com/api/v4/groups/123/projects?private_token=ABC&include_subgroups=True&per_page=100&page=1&with_shared=False?

miguelaferreira avatar May 04 '21 08:05 miguelaferreira

@miguelaferreira Thank you for your report. will check it in 1 day

LaserPhaser avatar May 04 '21 09:05 LaserPhaser

You can circumvent this by specifying the scheme in the Gitlab URL provided to --gitlab-url:

$ gitlab-clone --group=123 --token=ABC --gitlab-url https://gitlab.com

tomirio619 avatar Nov 10 '21 13:11 tomirio619

Hi, here running it from Debian 11 today:

~/.local/bin/gitlab-clone --group=my-group-id --token=my-token --gitlab-url=https://gitlab.com

And it start cloning the group and all subgroups resulting in a directory structure equivalent to that I have in GitLab but...

Enter passphrase for key '/home/my-user/.ssh/id_rsa': 
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Obviously it is an issue with the id_rsa, I'll try to figure it out but will be great to have a little more documentation. Not to much activity here right?

r3c4ll avatar Sep 15 '22 13:09 r3c4ll

I had a similar error (correct access rights) as the server dropped the connections when there were to many at once...

for me i fixed that in PR https://github.com/LaserPhaser/gitlab-group-clone/pull/8 Just to be sure, you can execute the corresponding git clone ... command without problems? ssh-agent up and containing the key? (Popen probably wont ask for password input) - otherwise try http (see my former PR) - it will use the token

eulenleber avatar Jan 23 '23 10:01 eulenleber