laserphaser / gitlab-group-clone Goto Github PK
View Code? Open in Web Editor NEWTool for recursive cloning whole gitlab group tree
License: MIT License
Tool for recursive cloning whole gitlab group tree
License: MIT License
When cloning using --http --token <MyToken>
, all git repository remotes include the token:
https://token:<MyToken>@gitlab.mycompany.com/path/to/repo.git
I think, at least by default, remotes should be created without the auth part (and we rely on git credential.helper=store to hold the token), and writing the token in each and every repo remotes should be an explicit request from the user.
Hello Arseni
I was able to install your contribution
gilcot@localhost $ pip install gitlab-clone
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Defaulting to user installation because normal site-packages is not writeable
Collecting gitlab-clone
Using cached gitlab_clone-0.1.3-py2.py3-none-any.whl (4.3 kB)
Requirement already satisfied: requests in /Users/gilcot/Library/Python/2.7/lib/python/site-packages (from gitlab-clone) (2.23.0)
Requirement already satisfied: idna<3,>=2.5 in /Users/gilcot/Library/Python/2.7/lib/python/site-packages (from requests->gitlab-clone) (2.9)
Requirement already satisfied: chardet<4,>=3.0.2 in /Users/gilcot/Library/Python/2.7/lib/python/site-packages (from requests->gitlab-clone) (3.0.4)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /Users/gildascotomale/Library/Python/2.7/lib/python/site-packages (from requests->gitlab-clone) (1.25.9)
Requirement already satisfied: certifi>=2017.4.17 in /Users/gildcot/Library/Python/2.7/lib/python/site-packages (from requests->gitlab-clone) (2020.4.5.1)
Installing collected packages: gitlab-clone
Successfully installed gitlab-clone-0.1.3
But I can't make it work
gilcot@localhost $ gitlab-clone -h
Traceback (most recent call last):
File "/Users/gilcot/Library/Python/2.7/bin/gitlab-clone", line 5, in <module>
from gitlab_clone.clonner import main
File "/Users/gilcot/Library/Python/2.7/lib/python/site-packages/gitlab_clone/clonner.py", line 30
f"https://{gitlab_url}/api/v4/groups/{group_id}/projects?private_token={token}&include_subgroups=True&per_page=100&page={page}&with_shared=False")
^
SyntaxError: invalid syntax
It seems to be related to argument parsing, but I may be wrong.
Hy,
I got this error because i dont have any groupId :
gitlab-clone: error: argument --group_id:
Thanks.
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?
OS: Ubuntu linux
Python: 3.8
First call works: gitlab-clone --group_id <my-id> --token <my-token> --gitlab-url <my-url>
When I want to update the repo by the repeated call of the previous command it fails with error:
[Errno 2] No such file or directory: 'cd'
The issues are the lines https://github.com/LaserPhaser/gitlab-group-clone/blob/master/gitlab_clone/clonner.py#L52-L53
Popen
cannot execute shell internal cd <dir>
,
but the following construct which changes directory before the command execution can be used:
command = shlex.split(f"git pull")
result_code = subprocess.Popen(command, cwd=path)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.